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

custom sensor return 2 but no error



I created a custom sensor. When there is an error it returns this:

2:Error Description

I see the 2 and the description on PRTG however the sensor still is green and has a check OK. What am I missing?.

custom-sensor notifications prtg

Created on Feb 6, 2018 1:39:10 AM

4 Replies



Hi Mark,

thank you for the KB-Post. Can you share the exact verbose script result here?

If possible, also share the script.

thank you

Created on Feb 6, 2018 11:55:51 AM by  Torsten Lindner [Paessler Support]



It I execute the code on the command line it returns this:

2:Error no connection

PRTG execs this same code and the value and the description both come through to PRTG. But the sensor must need to be setup to handle this or something.

Created on Feb 6, 2018 2:23:00 PM



This result means that the sensor value will be 2 then. Because the format for the response is:


If values above 0 mean an error, just define an error limit in the Channel Settings of the sensor accordingly.

Created on Feb 6, 2018 4:19:38 PM by  Torsten Lindner [Paessler Support]



My sensor app was printing to the console the error value and the description like the BAT examples do. However it seems as though PRTG was ALSO looking for a RETURN value.

Environment.Exit (2)

I added that in addition to the Console.Write (2,"Error Message");

Now it works.

I would have thought all custom sensors would act the same way but I was wrong.

Created on Feb 6, 2018 4:25:07 PM

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.