What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Custom PowerShell script: Return value when sensor is in error state

Votes:

0

Your Vote:

Up

Down

Hello,

I have several custom sensors, that check various things but I was wondering if there was a way of returning the value when the condition is in an error state? When the sensor is up and green, it returns the value to the device overview page with no problems.

Here is an image showing what I mean: https://dl.dropboxusercontent.com/u/3265030/Capture.PNG

The OK check shows the value, but the error state does not. If however, I go into the sensor details I can see the returned value so why doesn't it should on the device summary page?

https://dl.dropboxusercontent.com/u/3265030/Capture2.PNG

Here is the end part of my PowerShell script, which I think should work as they are both the same for exit 0 and exit 2:

if ($daystoExpiry -le "60")
{
    Write-Host $daystoExpiry" days until expired"
    exit 2
}
else
{
    Write-Host $daystoExpiry" days until expired"
    exit 0
}

custom-sensor powershell prtg

Created on Jul 17, 2013 9:08:10 AM by  robm82 (0) 1

Last change on Jul 17, 2013 3:07:33 PM by  Torsten Lindner [Paessler Support]



1 Reply

Votes:

0

Your Vote:

Up

Down

Hello,

thank you very much for your KB-Post. Instead of returning an error from the script if the value is too high, please try working with Error- or Warning-Limits in the Channel Settings here. So use exit 2 only if the sensor can't get the value at all, and for all numerical results use the limits in the Channel Settings. That should work better.

best regards.

Created on Jul 17, 2013 3:09:55 PM by  Torsten Lindner [Paessler Support]



Please log in or register to enter your reply.


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.