What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How to change status color of monitor sensor

Votes:

0

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 ?

color-state custom-script-exe script

Created on Mar 6, 2017 11:41:34 AM

Last change on Mar 7, 2017 8:21:18 AM by  Luciano Lingnau [Paessler]



1 Reply

Votes:

0

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]

Created on Mar 7, 2017 8:21:00 AM by  Luciano Lingnau [Paessler]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.