Paessler Blog - All about IT, Monitoring, and PRTG

Monitoring (Almost) Any SQL Server Through ADO with PRTG Network Monitor

Written by Dirk Paessler | Nov 25, 2009
Today I would like to share a custom EXE sensor script for PRTG that monitors any SQL server using ActiveX Data Objects (ADO) and the PowerShell scripting language.
There are two usage scenarios for this script:
  • Using this script you will be able to monitor any data source with PRTG that is accessible through ADO, including many database servers (e.g. SQL Server, Oracle, IBM DB2, MySQL, Sybase, Informix, Interbase, Firebird) as well as data files (Excel, Access, SQlite, Foxpro, Filemaker). Even Sharepoint, MS Project, Active Directory and Exchange are possible.
  • Although PRTG has built-in native sensors for the most used databases (Microsoft, MySQL and Oracle SQL servers) it can sometimes be helpful to use the ADO interface for monitoring.

How To Do It

  • First you need the "connection string" which tells ADO where and how to connect. The website http://www.connectionstrings.com/ offers predefined connections string for over 50 different data sources.
  • For Windows XP/2003/Vista/2008 R1: Download and install PowerShell on the machine that will run the script (your core server or a system running the associated probe). PowerShell is already included in Windows 7 and 2008 R2.
  • Download the script Demo Powershell Script - Connecting to database with ADO.ps1 from the PRTG 7 Addons Google Code project and place it into the following folder either on your PRTG core installation (if you want to use the LocalProbe) or on a Remote Probe System.
    \prtg network monitor\custom sensors\exe
  • Edit the settings in the "Parameters" section of the ps1 file for your needs.
  • In PRTG's web interface: create a new Custom EXE Sensor and select the filename mentioned above.
That's it, you should now see the sensor's results.