Hi
I'm trying to create a sensor compares the last result of two other sensors. One value should be less than 1. The other value should be 200-500
The problem i am having is that when the value of one sensor is less that one, i get the value prefixed with "<"
This is REALLY problematic as i need to do a comparison between two numbers!!
How can i get it to return just a number??
The code i'm using looks like this:
$Method = 'POST' $ContentType = 'application/json' $URI_SensorBP17 = 'https://prtg.oursite.com/api/getsensordetails.json?id='+$SensorIDBP17+'&[email protected]&passhash=123456789' $URI_SensorBP18 = 'https://prtg.oursite.com/api/getsensordetails.json?id='+$SensorIDBP18+'&[email protected]&passhash=123456789' # This function returns a deserialized object (not JSON!) $contentL1 = Invoke-RestMethod -uri $URI_SensorL1 -Method $Method -ErrorVariable errmsg -ErrorAction SilentlyContinue -ContentType $ContentType $contentL2 = Invoke-RestMethod -uri $URI_SensorL2 -Method $Method -ErrorVariable errmsg -ErrorAction SilentlyContinue -ContentType $ContentType if (($contentL1.sensordata.lastvalue -gt 5) -and ($contentL2.sensordata.lastvalue -lt 5)) { # Active on L1 $xmlToPRTG = @" <prtg> <result> <channel> Failover Monitor </channel> <value>50</value> <LimitMode>0</LimitMode> </result> </prtg> "@; $xmlToPRTG
And when lastvalue < 1, for the output i get:
$contentL1.sensordata.lastvalue = < 0,01 Mbit/s
Add comment