<%NUMBERING1%>.<%NUMBERING2%>.<%NUMBERING3%> PRTG Manual: Additional Sensor Types (Custom Sensors)
You can create and use your own custom sensors in PRTG to extend the standard sensor set. You can create your own sensors by using Windows Management Instrumentation Query Language (WQL), visual basic scripting, PowerShell, batch scripting, Structured Query Language (SQL) queries, by compiling an .exe file, by running Python scripts, or by translating JavaScript Object Notation (JSON) and Extensible Markup Language (XML) responses of a Representational State Transfer (REST) application programming interface (API) into sensor values.
You cannot use custom sensors on hosted probes in PRTG Hosted Monitor (except SSH sensors). If you want to use custom sensors, add them to a remote probe device.
Basics
For a general introduction, see the sections about EXE/Script sensors and section Custom Sensors, which contains details about the necessary return format for these sensors. WMI Custom sensors allow you to execute WQL requests.
Additionally, some types of SQL sensors execute script files with SQL queries:
The HL7 sensor sends messages that are stored in extra files on the probe system.
Custom Sensors in PRTG
After you install PRTG, you can find a selection of custom EXE/Script, Python, and WMI WQL script sensors in the PRTG program directory, as well as scripts with SQL queries for specific database sensors, REST configuration files in the JSON template (*.template) format for the REST Custom sensor, and .hl7 message files for the HL7 sensor. Many of the files are sample projects that you can edit and improve for your needs.
|
|
\Custom Sensors\EXE
|
The following custom sensors are available by default:
- Demo Batchfile - Returns 200.bat
- Demo Batchfile - Set sensorstate to error.bat
- Demo Batchfile - Set sensorstate to warning.bat
- Demo Cmd - Returns 200.cmd
- Demo EXE - Returns a random integer.exe
- Demo EXE - Returns number of files in folder (parameter).exe
- Demo EXE - Returns user of process.exe
- Demo Powershell Script - Available MB via WMI.ps1
- Demo Powershell Script - InterruptsPerSec via WMI.ps1
- Demo Powershell Script - Powershell Version.ps1
- Demo Powershell Script - Returns a fixed integer.ps1
- Demo Powershell Script - Returns a random integer.ps1
- Demo Powershell Script - Returns Random Integer and Warnings.ps1
- Demo VBScript - InterruptsPerSec via WMI.vbs
- Demo VBScript - Multiplies two integers(2 parameters).vbs
- Demo VBScript - Returns a fixed float value.vbs
- Demo VBScript - Returns a fixed integer.vbs
- Demo VBScript - Returns a random value.vbs
- Demo VBScript - Returns number of svchost processes.vbs
- Demo VBScript - Returns user of process.vbs
- Demo VBScript - Returns warning depending on number of svchost processes.vbs
- Demo VBScript - Timezone via WMI.vbs
- Demo VBScript - UTCTime via WMI.vbs
- Load_Test_CPU_1_Mio_Primes.exe
- Load_Test_CPU_10_Mio_Primes.exe
- Load_Test_Disk_Write_Read_1000_files.exe
- Load_Test_Disk_Write_Read_10000_files.exe
- Load_Test_Memory_Allocate_And_Free_400MB.exe
To create a new sensor based on one of these files, create a new EXE/Script sensor and choose the respective file from the EXE/Script list in the sensor settings.
We recommend that you not edit the demo files. Create your own new files and make sure to give them unique names that do not start with Demo, for example.
|
\Custom Sensors\EXEXML
|
The following custom sensor is available by default:
- Demo Batchfile - Returns static values in four channels.bat
To create a new sensor based on one of these files, create a new EXE/Script Advanced sensor and choose the respective file from the EXE/Script list in the sensor settings.
|
\Custom Sensors\hl7
|
The following custom sensors are available by default:
Each file contains an HL7 message that is conform to the HL7 message format. To create a new sensor based on one of these files, create a new HL7 sensor and choose the respective file from the HL7 Message list in the sensor settings. You can override certain message headers in the files via the sensor settings.
|
\Custom Sensors\python
|
The following custom sensor is available by default:
This Python example script only returns fixed values in two channels to demonstrate the usage. To create a new sensor based on this file, create a new Python Script Advanced sensor and choose the file from the Script list in the sensor settings.
|
\Custom Sensors\rest
|
The following custom sensors are available by default:
- kemp.loadbalancer.template: maps values returned by the RESTful API of a KEMP load balancer to channels, for example, CPU usage, memory usage, traffic
- prtg-sensor-stats.template: maps values returned by the PRTG API to channels that show the count of each sensor status on the local probe
- windows.docker.container.stats.template: maps values returned by the Docker Engine API to channels, for example, CPU usage, memory usage, traffic, input/output (I/O)
- wunderground.template: maps values returned by the Weather Underground API to channels, for example, temperature, dew point, pressure, wind speed, wind direction
To create a new sensor based on one of these files, create a new REST Custom sensor on the device that provides the REST API and choose the file from the REST Configuration list in the sensor settings.
|
\Custom Sensors\scripts\examples\python
|
The following example scripts are available by default:
- dice_roll.py
- dropbox_space_free.py
- hybrid_parameters_ping.py
- remote_ssh_linux_network.py
- remote_ssh_linux_system_load.py
To use the example scripts, copy them to the \Custom Sensors\scripts subfolder of the PRTG program directory. To create a new sensor based on one of these files, create a new Script v2 sensor and choose one or more Python scripts from the list in the script specific settings. PRTG creates one sensor for each script that you select.
|
\Custom Sensors\sql\[dbms]
|
The following custom sensor is available by default:
You can find this demo SQL query script in each subfolder for each supported database management system (DBMS): \adosql, \mssql, \mysql, \oracle, \postgresql
To create a new sensor that uses one of the scripts in the dbms folders, create the according sensor (see above for supported sensors) and choose the respective file from the SQL Query File list in the sensor settings.
|
\Custom Sensors\WMI WQL scripts
|
The following custom sensors are available by default:
- Demo WQL Script - Get Win32LogicalDiscFreeMB.wql
- Demo WQL Script - Get Win32OsBuildnumber.wql
- Demo WQL Script - Get Win32PercentProcessorIdleTime.wql
- Demo WQL Script - Get Win32PercentProcessorTime.wql
To create a new sensor based on one of these files, create a new WMI Custom sensor and choose the respective file from the WQL File list in the sensor settings.
|
Download Custom Sensors
Good resources to find custom sensors that other users and we from Paessler share are the PRTG Sensor Hub and our Knowledge Base. In the Knowledge Base, search for the tag custom-script-exe to find a lot of custom sensors.
More
KNOWLEDGE BASE
Guide for PowerShell-based custom sensors
Custom sensors
How can I share my self-written PRTG script/program with other PRTG users?
How can I test if parameters are correctly transmitted to my script when using an EXE/Script sensor?
Why do I have to store SQL sensor queries and custom scripts in files on the probe computer?
I want to use the Script v2 sensor example scripts. What do I need to know?
PAESSLER WEBSITE
You can find useful scripts for sensors in the PRTG Sensor Hub