Information May Be Out-of-Date
This page about licensing and maintenance is shown for reference purposes only. Information on this page is not maintained and may no longer be valid.
For recent information, please visit our Frequently Asked Questions (FAQs) page.
Monitoring numeric non-integer SNMP values with IPCheck Server Monitor
If you try to monitor a numeric non-integer value (e.g. fractional values) using the SNMP sensor of IPCheck Server Monitor you will only see zero values. The reason is that the standard SNMP sensors of IPCheck Server Monitor only support integer values.
By using a Custom Script Sensor that actually performs some calculations this limitation can be overcome. The following script shows how to do this:
' Script to read non-integer OIDs and multiply them up for IPCheck
' data1 == OID (1.3.... etc)
' data2 == warning threshold
' data3 == error threshold
'initialize sensor's result to status of "error"
sensor.resultvalue=0
'For Version 5.2 or earlier use: sensor.resultvalue=0
sensor.status=srError
sensor.errortype=etNone
'get the snmp values (as string)
result=snmpget("public",data1)
'result="ERROR"
'check for errors (always begins with the word "ERROR")
if pos("ERROR",result)=1 then
sensor.errorstring=result
sensor.errortype=etprotocol
else
sensor.status=srok
mynumber=round (result)
if mynumber > data3 then
sensor.status=srError
else
if mynumber > data2 then
sensor.status=srWarning
end if
end if
mynumber=strtoint(mynumber)
sensor.resultvalue=mynumber
end if
The most important line of code is marked green in the code. This line converts the float value into an integer value. If may also choose to multiply the value with e.g. 1000 if you also need to look at changes below the integer resolution.
When creating the new sensor in IPCheck's user interface set the three data fields as follows:
- data1 = OID of the value you want to monitor
- data2 = your warning threshold
- data3 = your error threshold
Please see the links in the Related Articles Section below for more information. The basics of Custom Script sensors are explained in the manual of IPCheck Server Monitor.
Thanks to Stuart Hall for sharing this tip.