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

Advanced EXE/Script sensor: Channel with varying error threshold

Votes:

0

Hi,

I am writing an "advanced" sensor using PowerShell. The task is to monitor a scheduled event which takes place hourly from 06:00 to 20:00. Currently the sensor channel reports the time delta between "now" and the most recent event, which was a bit tricky to achieve but works fine. This is only one of 3 or 4 channels which are also under development.

I want the channel to go into error state when the most recent execution is more than 120 minutes in the past, except when the current time of day is between 20:00 and 06:00. How do I manage that? If I understand the documentation correctly:

- adding <error>1</error> to the <result> means "sensor is not working," rather than "sensor is ok but the value is bad." The actual sensor value is not displayed in this case.

- adding <LimitMaxError> has an effect only during the first sensor execution, so it is not possible to change the limit automatically, depending on the time of day.

I could subtract the "night time hours" from the time difference but that would, in my eyes, distort the measurement. Is there any other solution?

Thanks a lot

Hans

custom-script-exe custom-sensor prtg

Created on Apr 30, 2021 7:26:54 AM

Last change on Apr 30, 2021 2:35:42 PM by  Felix Wiesneth [Paessler Support]



2 Replies

Votes:

0

Hello Hans,

Thank you for your message.

Regarding what you would like to achieve, you have the possibility to pause the sensor between 20:00 and 6:00 with a schedule.

Otherwise, you have the possibility to modify/disable the channel limit with the API of PRTG, via the following API calls:

  • Modify the channel limit (the limits must be activated)
/api/setobjectproperty.htm?id=SENSORID&subtype=channel&subid=CHANNELID&name=limitmaxerror&value=120&username=PRTGUSER&passhash=PASSHASH
  • Disable the channel limit
/api/setobjectproperty.htm?id=SENSORID&subtype=channel&subid=CHANNELID&name=limitmode&value=0&username=PRTGUSER&passhash=PASSHASH

To enable the channel limits again, you just have to replace "value=0" to "value=1" in the request above.

If you have questions, let us know.

Regards.

Created on May 4, 2021 6:36:37 AM by  Florian Lesage [Paessler Support]



Votes:

0

Maybe adding a channel dedicated to the error status of the actual channel could be a solution.

So your script could output that error channel value according to any logic you want, while keeping the same PRTG settings (i.e. threshold) for the error channel

Created on Feb 22, 2022 10:15:16 AM




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.