Calculating with multiple oids
-
Hello
I would like to monitor router memory usage but in order for that i need to poll 4 seperate values and do some math with them. What would be the cleanest approach to solve this problem?
Oids:
.1.3.6.1.2.1.25.2.3.1.3.1 [STRING] = Physical memory
.1.3.6.1.2.1.25.2.3.1.4.1 [INTEGER] = 1024 (hrStorageAllocationUnits)
.1.3.6.1.2.1.25.2.3.1.5.1 [INTEGER] = 160908 (hrStorageSize)
.1.3.6.1.2.1.25.2.3.1.6.1 [INTEGER] = 128164 (hrStorageUsed)Demo math:
125,16*100 / 157,13 = 79,65%Desired output:
Physical memory = 79,65% -
At some point in the future, when https://track.radensolutions.com/issue/NX-2322 will be implemented it would be possible to specify muliple OIDs and they will appear as variables in transformation script.
For now - either a script DCI that does all SNMP job and calculation and returns final result, or SNMP DCI that reads one OID and the rest being read in transformation script, e.g.:
totalMem = $1; transport = $node->createSNMPTransport(); if (transport == null) return null; freeMem = transport->getValue(".1.3.6.1.4.1.14823.2.2.1.1.1.11.1.4.1"); if (freeMem == null) return null; return format(100UL * freeMem / totalMem, 1, 0);The only bonus of the first approach is that you can perform recalculation for historical collected values.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login