Heck here is the OID table in question, so 0 is a value (don’t bother since 0=false) if you really need to test for 0, add some other value to it first.
Object ID: 1.3.6.1.4.1.17713.21.1.3.1
GPS Current SYNC State:
0 - The Initialization State
1 - The No Synchronization State
2 - The Synchronization State
3 - The Hold Off State
4 - The Regaining Sync State
5 - The Free Run State
This should work for the device appearance…
if(oid(“1.3.6.1.4.1.17713.21.1.3.1,10,5”)=2,“Sync OK”,if(oid(“1.3.6.1.4.1.17713.21.1.3.1,10,5”)=3,“Hold off”,if(oid(“1.3.6.1.4.1.17713.21.1.3.1,10,5”)=4,“Retraining”,“failed to read sync”)))
I always try to get people to use functions to better handle the issue.
Always make a function that returns the value stored in the oid or false then if the device is unreachable or the oid doesn’t exist you get “false” then the probe would perform more predictably I also try to get people to put the cache time in their function so that the negative cache time doesn’t break things. (negative cache time is 300 seconds) that means when a read of an oid fails that failure is cached for 300 seconds. A device that has an error will not come back up until after the negative cache time expires (5 minutes) and a successful probe happens.
Function
Name: syncstate
Code: if(string_size(oid(“1.3.6.1.4.1.17713.21.1.3.1”,10,5)) , oid(“1.3.6.1.4.1.9.2.1.57.0”, 10 ,5) ,“False”)
For the appearance
[syncstate()] or
[if(syncstate()=2,“Sync OK”, if(syncstate()=3,“Sync Hold”, if(syncstate()=4,“Sync training”, “Sync Unknown”)]
for the available line of the probe
syncstate() <> “False”
For the error line of the probe
if(syncstate()<>“False”, if(syncstate()=2,“”, if(syncstate()=3,“Sync Hold”, if(syncstate()=4,“Sync training”, Concatenate("Sync Unknown = “, syncstate()) ))) ,” Sync read failed ")
Notice the check for false so we can make sure we have a value before we start since the device is not responding.
So now if syncstate =2 the probe will be up, all others states create some other message and if the syncstate function can’t read any value you should get “Sync read failed”.
Sorry if there is errors in the syntax… I don’t have the gear to test it.
Lebowski