Category Archives: PRTG

How to monitor Microsoft Data Protection Manager (DPM) Alerts with the custom advanced Sensor in Paessler PRTG

With this VBS Script you can monitor DPM Alerts (tested on 2012 R2) with the custom Advanced XML Sensor in Paessler PRTG.
https://prtg.paessler.com/api.htm?tabid=7
Replace server.domain.local with IP or Name of your DPM Database Server and instance with the SQL instance name.
The PRTG Service Account needs to have appropriate permissions on DPM Database Server (SYSTEM uses AD Computer Account to access remote Servers).
Save the VBS in “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML” Folder.
Create a Custom EXE/Script Advanced Sensor and select the Script.

locstrServer = "server.domain.local\instance"
locstrText = ""
locstrStatus = ""
strDBCon = ""
strDBCon = "Provider=sqloledb;Data Source=" & locstrServer & ";Initial Catalog=DPMDB;Integrated Security=SSPI;Connect Timeout=30;"
on error resume next
Set objDBCon = CreateObject("ADODB.Connection")
objDBCon.Open strDBCon
on error goto 0
Set ObjDBRS = CreateObject("ADODB.Recordset")
wscript.echo "<?xml version=""1.0"" encoding=""Windows-1252"" ?>"
wscript.echo "<prtg>"
strSQLCmdText = "select count(Severity) from vw_DPM_Alerts where Severity = 2 and ResolvedTime is null"
set ObjDBRS = objDBCon.Execute(strSQLCmdText)
wscript.echo "<result>"
wscript.echo "<channel>Information Alerts Count</channel>"
wscript.echo "<value>" & cint(ObjDBRS(0)) & "</value>"
wscript.echo "<unit>Count</unit>"
wscript.echo "</result>"
strSQLCmdText = "select count(Severity) from vw_DPM_Alerts where Severity = 1 and ResolvedTime is null"
set ObjDBRS = objDBCon.Execute(strSQLCmdText)
wscript.echo "<result>"
wscript.echo "<LimitMaxWarning>0</LimitMaxWarning>"
wscript.echo "<LimitMode>1</LimitMode>"
wscript.echo "<channel>Warning Alerts Count</channel>"
wscript.echo "<LimitWarningMsg>DPM Warning Alerts(s)!</LimitWarningMsg>"
wscript.echo "<value>" & cint(ObjDBRS(0)) & "</value>"
wscript.echo "<unit>Count</unit>"
wscript.echo "</result>"
strSQLCmdText = "select count(Severity) from vw_DPM_Alerts where Severity = 0 and ResolvedTime is null"
set ObjDBRS = objDBCon.Execute(strSQLCmdText)
wscript.echo "<result>"
wscript.echo "<LimitMaxError>0</LimitMaxError>"
wscript.echo "<LimitMode>1</LimitMode>" 
wscript.echo "<channel>Critical Alerts Count</channel>"
wscript.echo "<LimitErrorMsg>DPM Critical Alerts(s)!</LimitErrorMsg>"
wscript.echo "<value>" & cint(ObjDBRS(0)) & "</value>"
wscript.echo "<unit>Count</unit>" 
wscript.echo "</result>"
wscript.echo "</prtg>"

How to monitor Hyper-V Replica Health with the custom advanced Sensor in Paessler PRTG

With this VBS Script you can Monitor Hyper-V Replica Health with the custom Advanced XML Sensor in Paessler PRTG.
https://prtg.paessler.com/api.htm?tabid=7
Replace server.domain.local with IP or DNS Name of your Hyper-V Server.
The PRTG Service Account needs to have Admin rights on Hyper-V Host (SYSTEM uses AD Computer Account to access remote Servers).
Save the VBS in “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML” Folder.
Create a Custom EXE/Script Advanced Sensor and select the Script.

locstrServer = "server.domain.local"
locstrText = ""
locstrStatus = ""
set objWshShell = CreateObject("WScript.Shell")
wscript.echo "<?xml version=""1.0"" encoding=""Windows-1252"" ?>"
wscript.echo "<prtg>"
locstrCommand = "cmd /c powershell.exe Invoke-Command -ComputerName " & locstrServer & " -ScriptBlock { Get-VMReplication ^| where Health -eq 'Normal' ^| measure-object }"
Set locobjExec = objWshShell.Exec(locstrCommand)
Do While Not locobjExec.StdOut.AtEndOfStream
 locstrReadline = trim(locobjExec.StdOut.ReadLine())
 locstrReadline = replace(locstrReadline, " ", "")
 if left(lcase(locstrReadline), len("count:")) = "count:" then 
  wscript.echo "<result>"
  wscript.echo "<channel>Health Normal Count</channel>"
  locintcount = cint(replace(lcase(locstrReadline), "count:", ""))  
  wscript.echo "<value>" & locintcount & "</value>"
  wscript.echo "<unit>Count</unit>"  
  wscript.echo "</result>"
 end if
Loop
locstrCommand = "cmd /c powershell.exe Invoke-Command -ComputerName " & locstrServer & " -ScriptBlock { Get-VMReplication ^| where Health -eq 'Warning' ^| measure-object }"
Set locobjExec = objWshShell.Exec(locstrCommand)
Do While Not locobjExec.StdOut.AtEndOfStream
 locstrReadline = trim(locobjExec.StdOut.ReadLine())
 locstrReadline = replace(locstrReadline, " ", "")
 if left(lcase(locstrReadline), len("count:")) = "count:" then 
  wscript.echo "<result>"
  wscript.echo "<LimitMaxWarning>0</LimitMaxWarning>"
  wscript.echo "<LimitMode>1</LimitMode>"
  wscript.echo "<channel>Health Warning Count</channel>"
  locintcount = cint(replace(lcase(locstrReadline), "count:", ""))
  wscript.echo "<LimitWarningMsg>Hyper-V Replica(s) Health Warning!</LimitWarningMsg>"
  wscript.echo "<value>" & locintcount & "</value>"
  wscript.echo "<unit>Count</unit>"
  wscript.echo "</result>"
 end if
Loop
locstrCommand = "cmd /c powershell.exe Invoke-Command -ComputerName " & locstrServer & " -ScriptBlock { Get-VMReplication ^| where Health -eq 'Critical' ^| measure-object }"
Set locobjExec = objWshShell.Exec(locstrCommand)
Do While Not locobjExec.StdOut.AtEndOfStream
 locstrReadline = trim(locobjExec.StdOut.ReadLine())
 locstrReadline = replace(locstrReadline, " ", "")
 if left(lcase(locstrReadline), len("count:")) = "count:" then 
  wscript.echo "<result>"
  wscript.echo "<LimitMaxError>0</LimitMaxError>"
  wscript.echo "<LimitMode>1</LimitMode>"  
  wscript.echo "<channel>Health Critical Count</channel>"
  locintcount = cint(replace(lcase(locstrReadline), "count:", ""))  
  wscript.echo "<LimitErrorMsg>Hyper-V Replica(s) Health Critical!</LimitErrorMsg>"
  wscript.echo "<value>" & locintcount & "</value>"
  wscript.echo "<unit>Count</unit>"  
  wscript.echo "</result>"
 end if
Loop
if locstrStatus <> "" then wscript.echo locstrStatus
if locstrText <> "" then wscript.echo locstrText
wscript.echo "</prtg>"

How to monitor Hyper-V Replica Health with Paessler PRTG

With this quick and dirty VBS Script you can Monitor Hyper-V Replica Health with Peassler PRTG.
Replace server.domain.local with IP or DNS Name of your Hyper-V Server.
The PRTG Service Account needs to have Admin rights on Hyper-V Host (SYSTEM uses AD Computer Account to access remote Servers).
Save the VBS in “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE” Folder.
Create a Custom EXE/Script Sensor and select the Script.

set objWshShell = CreateObject("WScript.Shell")

locstrCommand = "cmd /c powershell.exe Invoke-Command -ComputerName server.domain.local -ScriptBlock { Get-VMReplication ^| where Health -ne 'Normal' ^| measure-object }"

Set locobjExec = objWshShell.Exec(locstrCommand)

Do While Not locobjExec.StdOut.AtEndOfStream
 locstrReadline = trim(locobjExec.StdOut.ReadLine())
 locstrReadline = replace(locstrReadline, " ", "")
 wscript.echo locstrReadline
 if left(lcase(locstrReadline), len("count:0")) = "count:0" then 
  wscript.echo "0:Ok"
  wscript.quit 0
 end if
Loop

wscript.echo "2:One or more Hyper-V Replicas are different from Normal!"
wscript.quit 2

How to monitor Dell MD3200 Health with Paessler PRTG

With this custom VBS Script you can Monitor the Health of a Dell MD3200 with Peassler PRTG.
Replace controller1.domain.local with IP or DNS Name of your Out Of Band Management interface from your controller 1.
Replace controller2.domain.local with IP or DNS Name of your Out Of Band Management interface from your controller 2.
Save the VBS in “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE” Folder.
Create a Custom EXE/Script Sensor and select the Script.

set objWshShell = CreateObject("WScript.Shell")
CheckStorageArrayHealthStatus """C:\Program Files (x86)\Dell\MD Storage Manager\client\smcli.exe"" controller1.domain.local -c ""show storageArray healthStatus;""" 
CheckStorageArrayHealthStatus """C:\Program Files (x86)\Dell\MD Storage Manager\client\smcli.exe"" controller2.domain.local -c ""show storageArray healthStatus;"""

Sub CheckStorageArrayHealthStatus(locstrCommand)  
	dim locobjExec, locstrReadline
	Set locobjExec = objWshShell.Exec(locstrCommand)
	Do While Not locobjExec.StdOut.AtEndOfStream
		locstrReadline = trim(locobjExec.StdOut.ReadLine())
		wscript.echo locstrReadline
		if left(lcase(locstrReadline), len("storage array health status")) = "storage array health status" then
			if left(lcase(locstrReadline), len("storage array health status = optimal.")) = "storage array health status = optimal." then
				wscript.echo "0:Ok"
				wscript.quit 0
			end if
		end if
	Loop
end sub

wscript.echo "2:Need Attention"
wscript.quit 2