Count SNMP walk results
-
Hi,
As a new user to NetXMS I still cannot believe just how easy it is to use. I have been looking for a replacement to the old RRD based systems for a while and this is blowing everything else away. I just have a couple of things I am struggling to get worked out (custom scripting seems the way to go with these) that I would like to iron out before I add it to my production. I have split them in to two posts to keep it simpler.
This topic is an SNMP Walk query. I am trying to work out how I can count the lines in a SNMP Walk. For example, I might want to count the number of Arp entries where no SNMP OID exists. I would like to be able to get just a count as an integer from walking 1.3.6.1.2.1.4.22.1.2. Is this possible?
Many thanks.
-
Very easy with a "Script" type DCI.
Just create a script named "count_ARP_entries" in the script library, and used that for the DCI parameter.
(DCI origin will of course be "Script")For the script, you can do this:
walk_oid = "1.3.6.1.2.1.4.22.1.2"; tube = CreateSNMPTransport($node); if (tube == null) return null; varbinds = SNMPWalk(tube, walk_oid); if (varbinds == null) return null; return varbinds->size;Refferences:
https://wiki.netxms.org/wiki/NXSL_Function_Reference
https://wiki.netxms.org/wiki/SG:Script_Examples -
Thanks, Tomas. Works perfectly

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