Hi,

i'm trying to get get PRTG to execute a Powershell Script to return the number of unregistered XenDesktops. The Script is working without PRTG but wihin PRTG i only get an error message. The weird part is that the Error Message evreytime is Error:PU132*(Code: PE132*), except the * are the real Values from the script. For example if i have 4 unregistered machines i get the message Error: PU1324 (Code: PE1324).

Am i doing anything wrong? Here is the script:

asnp citrix.broker*

$unregistered = Get-BrokerDesktop -SummaryState Unregistered


$unregisteredcount = @($unregistered).Count

if ($unregisteredcount -eq 1)
{
$unregisteredcount = 0;
}


write-host $($unregisteredcount)

The if-Sequnece in the middle i'm using because the script always returns atleast 1.


Article Comments

Hi,
the return values (in order for PRTG to understand them) have to be in the format:

value:message
Return Code

where Return code is optional. So in your case the return value should look something like the following:

asnp citrix.broker*

$unregistered = Get-BrokerDesktop -SummaryState Unregistered


$unregisteredcount = @($unregistered).Count

if ($unregisteredcount -eq 1)
{
$unregisteredcount = 0;
}

$returnValue = $unregisteredaccount ":Some Message" 
write-host $returnValue
exit 0

Where the following Exit Codes can be used to control the sensor status in PRTG:

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)

For further information see also the documentation.
Best regards


Oct, 2012 - Permalink

Thanks, that helped!


Oct, 2012 - Permalink