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>"
Advertisements

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

  1. Marian Danisek

    I’m getting error : Operation is not allowed when object is closed. Code:800A0E78. Source ADODB.Connection,
    I have even tried running on localhost where DPM is running

    Reply
    1. Marian Danisek

      I found where was the issue. I have to modify : Initial Catalog=DPMDB to point to actual DB which was DPM_DP_hostname

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s