Hello ! I'm trying to use EXE/SCRIPT sensor, how ever I cant find in any example how to change color of monitor status when some error occur. When I use linux SSH scripts I just need to send a different string like: echo "0:100:OK" to get green status or "1:0:ERROR" to get red status, but when I'm using exe I only get green status because all examples show "VALUE:STRING" I don't have the color variable. Can anybody try to help me with this issue ?


Article Comments

Hello there and thank you for your KB-Post. Please refer to the table below for the exitcodes that you can use in exe scripts to change the status of the sensor.

ValueDescription
0OK
1WARNING
2System Error (e.g. a network/socket error)
3Protocol Error (e.g. web server returns a 404)
4Content Error (e.g. a web page does not contain a required word)

This is documented in PRTG under Setup > PRTG API on the "Custom Sensors" tab. You'll also find some examples in the C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE by default:

Demo Batchfile - Set sensorstate to warning.bat

@ECHO OFF
ECHO 200:Value too high

REM Set PRTG Sensor to Warning by returning <1>
Exit 1

Demo Batchfile - Set sensorstate to error.bat

@ECHO OFF
ECHO 200:Value is much too high
REM Set PRTG Sensor to Error by returning <2>
Exit 2

You can also use the Advanced sensor variants and use the XML/JSON format, in this case you can use the <error>1</error> and <Warning>1</Warning> in the output to modify the sensor's status:

Best Regards,
Luciano Lingnau [Paessler Support]


Mar, 2017 - Permalink