What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

ADO SQL v2 Sensor showing error

Votes:

0

We've updated to Preview version 16.2.24.3624+. I wanted to add the new ADO SQL v2 Sensor to replace our depricated old ADO SQL Sensors, but I get the error message "An item with the same key has already been added." everytime, no matter what connection string I use (Postgres, MS SQL, ...). Is there any way to fix it?

ado ado-sql-sensor adosql

Created on May 11, 2016 8:38:55 AM



Best Answer

Accepted Answer

Votes:

1

Hello,

We released the PRTG version 16.2.24.3791/3792 yesterday evening with the bigfix for the SQL v2 sensors. Please update to this version to solve the issue.

Created on May 13, 2016 7:28:29 AM by  [email protected]

Last change on Oct 27, 2016 2:03:59 PM by  [email protected]



7 Replies

Votes:

0

Same issue here.

Created on May 11, 2016 10:35:44 PM



Votes:

0

Hello,

We are able to reproduce this in the PRTG stable and Preview version and can confirm this is a current bug. We will be providing a fix for the same in a few days.

Please bear with us.

Created on May 12, 2016 7:50:28 AM by  [email protected]



Votes:

0

If anyone needs a ADO SQL sensor right now, I wrote a VBScript:

On Error Resume Next

Set objDBCommunicator = new DBCommunicator

Set objArgs 		= Wscript.Arguments
Set objConnection	= CreateObject("ADODB.Connection")
Set objRecordSet	= CreateObject("ADODB.RecordSet")

strPRTGStart 	=	"<prtg>"
strPRTGEnde 	=	"</prtg>"

Class DBCommunicator
	Public Function DBConnect(StrCon)
		On Error Resume Next
		
		objConnection.Open StrCon
		If Err.Number = 0 then
			DBConnect = True
		Else
			DBConnect = False
		End If
	End Function

	Public Function QueryDB(StrQuery)
		objRecordSet.Open StrQuery, objConnection
		If Err.Number = 0 then
			Do Until objRecordSet.EOF
				For each objField in objRecordSet.Fields
					If objField.Name = "" Then
						'Wscript.Echo "Wert" & " = " & objField.Value
						QueryDB = QueryDB	&	"	<result>" & VBCRLF
						QueryDB = QueryDB	&	"		<channel>" & strChannelNameCount & "</channel>" & VBCRLF
						QueryDB = QueryDB	&	"		<value>" & objField.Value & "</value>" & VBCRLF
						QueryDB = QueryDB	&	"	</result>" & VBCRLF
						'Wscript.Echo QueryDB
					Else
						'Wscript.Echo objField.Name & " = " & objField.Value
						QueryDB = QueryDB	&	"	<result>" & VBCRLF
						QueryDB = QueryDB	&	"		<channel>" & objField.Name & "</channel>" & VBCRLF
						QueryDB = QueryDB	&	"		<value>" & objField.Value & "</value>" & VBCRLF
						QueryDB = QueryDB	&	"	</result>" & VBCRLF
						'Wscript.Echo QueryDB
					End If
					
				Next
				objRecordSet.MoveNext
			loop
		Else
			QueryDB = QueryDB		&	"	<error>1</error>" & VBCRLF
			QueryDB = QueryDB		&	"	<text>Database Connect failed, please check parameters: " & chr(34) & "ADO SQL connectstring" & chr(34) & " , " & chr(34) & "SQL Query" & chr(34) & " , " & chr(34) & "Channel Name for Count" & chr(34) & "</text>" & VBCRLF
		End If
	End Function

	Public Function DBdisConnect
		objRecordSet.close
		objConnection.close
	End Function
End Class

'########################################

'objArgs(0)=Connectstring - "Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;Data Source=Server\Instance;Initial Catalog=DB;"
'objArgs(1)=SQL Query -     "select count(*) Schema.Computers;"
'objArgs(2)=Channel Name when Count in Query - "PCs"

Wscript.Echo "Number of parameters: " & objArgs.Count
Wscript.Echo ""
If objArgs.Count < 2 then
		strPRTGError = strPRTGError		&	"	<error>1</error>" & VBCRLF
		strPRTGError = strPRTGError		&	"	<text>Not enough parameters, please add or check parameters: " & chr(34) & "(Required) ADO SQL connectstring" & chr(34) & " , " & chr(34) & "(Required) SQL Query" & chr(34) & " , " & chr(34) & "(Optional) Channel Name for Count" & chr(34) & "</text>" & VBCRLF
ElseIf objArgs.Count = 2 then
	If InStr(LCase(objArgs(1)), "count(*)", 1) = True Then
		strPRTGError = strPRTGError		&	"	<error>1</error>" & VBCRLF
		strPRTGError = strPRTGError		&	"	<text>Count(*) in parameters, please add or check parameters: " & chr(34) & "(Required) ADO SQL connectstring" & chr(34) & " , " & chr(34) & "(Required) SQL Query" & chr(34) & " , " & chr(34) & "(Optional) Channel Name for Count" & chr(34) & "</text>" & VBCRLF
	Else
		strConnectString	= objArgs(0)
		strSQLQuery			= objArgs(1)
		strChannelNameCount	= ""
		
		strResult=objDBCommunicator.DBConnect(strConnectString)
		If strResult <> True Then
			strPRTGError = strPRTGError		&	"	<error>1</error>" & VBCRLF
			strPRTGError = strPRTGError		&	"	<text>Database connect failed, please check parameters: " & chr(34) & "(Required) ADO SQL connectstring" & chr(34) & " , " & chr(34) & "(Required) SQL Query" & chr(34) & " , " & chr(34) & "(Optional) Channel Name for Count" & chr(34) & "</text>" & VBCRLF
		ElseIf strResult = True Then
			strPRTGChannnel = objDBCommunicator.QueryDB(strSQLQuery)
			objDBCommunicator.DBdisConnect
		End If
	End If
ElseIf objArgs.Count = 3 then
	strConnectString	= objArgs(0)
	strSQLQuery			= objArgs(1)
	strChannelNameCount	= objArgs(2)
	
	strResult=objDBCommunicator.DBConnect(strConnectString)
	If strResult <> True Then
		strPRTGError = strPRTGError		&	"	<error>1</error>" & VBCRLF
		strPRTGError = strPRTGError		&	"	<text>Database Connect failed, please check parameters: " & chr(34) & "(Required) ADO SQL connectstring" & chr(34) & " , " & chr(34) & "(Required) SQL Query" & chr(34) & " , " & chr(34) & "(Optional) Channel Name for Count" & chr(34) & "</text>" & VBCRLF
	ElseIf strResult = True Then
		strPRTGChannnel = objDBCommunicator.QueryDB(strSQLQuery)
		objDBCommunicator.DBdisConnect
	End If
End If

If InStr(strPRTGError,"<error>1</error>") Then
	strPRTG = strPRTGError
ElseIf InStr(strPRTGChannnel,"<error>1</error>") Then
	strPRTG = strPRTGChannnel
Else
	strPRTG = strPRTGChannnel
End If

wscript.echo strPRTGStart
wscript.echo strPRTG
wscript.echo strPRTGEnde

Maybe it helps as long as we wait for the fix.

Created on May 12, 2016 7:57:14 AM

Last change on May 13, 2016 12:44:28 PM by  Arne Seifert [Paessler Support]



Votes:

0

Hi there We have the same issue

thanks Ash

Created on May 12, 2016 9:06:33 AM



Accepted Answer

Votes:

1

Hello,

We released the PRTG version 16.2.24.3791/3792 yesterday evening with the bigfix for the SQL v2 sensors. Please update to this version to solve the issue.

Created on May 13, 2016 7:28:29 AM by  [email protected]

Last change on Oct 27, 2016 2:03:59 PM by  [email protected]



Votes:

0

I am now seeing that problem with PRTG Network Monitor 16.4.27.6720+

Created on Oct 26, 2016 1:14:26 PM



Votes:

0

Please go to the sensor's settings, and Configure the "DEBUG OPTION" "Write sensor result to disk(Filename: Result of Sensor [ID].txt" The log will be written on the probe that monitors that sensor under (%ProgramData%\Paessler\PRTG Network Monitor\Logs (Sensors)) and send the result file to [email protected] Please refer to this kB-article.

Created on Oct 27, 2016 2:03:37 PM by  [email protected]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.