I’m trying to create a probe to monitor specific disks % free space.
It has struck the 32bit integer wrap issue in snmp for large disks i.e. the oid value returned is negative
I notice that this is corrected internally by the built in view.
How do I replicate this with a function ?
Something like this would get close, but an oid output appears to be text, and adding an offset doesn’t work.
[oid(“1.3.6.1.2.1.25.2.3.1.6.1.2”,10,5) + 4294967296]
values returned are
[oid(“1.3.6.1.2.1.25.2.3.1.6.2”,10,5)] = -1983960238 used
[oid(“1.3.6.1.2.1.25.2.3.1.5.2”,10,5)] = -1445422593 size
Dude shows size as 2849544703 and free as 2310888030 on snmp storage detail.
Well I worked it out eventually.
For a disk at index 2, this will handle the negative offset.
Adjust the last digit of the iods after the first one for other offsets ie. change 1.3.6.1.2.1.25.2.3.1.6.2 to 1.3.6.1.2.1.25.2.3.1.6.3 etc.
It seems to be within about .5% accurate.
Function named UsedDisk2
if(array_size(oid_column(“1.3.6.1.2.1.25.2.3.1.6”,10,5)),if(oid(“1.3.6.1.2.1.25.2.3.1.6.2”,10,5) < 1,round(((oid(“1.3.6.1.2.1.25.2.3.1.6.2”,10,5)+4294967296)/(oid(“1.3.6.1.2.1.25.2.3.1.5.2”,10,5)+4294967296))*100),round((oid(“1.3.6.1.2.1.25.2.3.1.6.2”,10,5)/oid(“1.3.6.1.2.1.25.2.3.1.5.2”,10,5))*100)),“False”)
probe alert at 85% used
Available: UsedDisk2()<>“False”
Error: if(UsedDisk2()<>“False”,if(UsedDisk2() < 85, “”, concatenate("Warning: Drive = ", UsedDisk2(), “% Used”)), “Failed to read Drive”)
Value: UsedDisk2()
Unit: %
Not perfect, but useful.
The Dude may be old, but still Rocks…
(a bit like me
)