Netxms 3.1.261 and device discovery
-
I have a large class of devices (perhaps mostly Cisco?) that are failing discovery in an odd way.
- Devices are detected with isSNMP=Yes, GENERIC driver, and added to db
- Manual inspection shows that devices were added with SNMP 'public' community
- Devices respond to a snmpwalk using 'public' with the following:
iso.3.6.1.2.1 = No more variables left in this MIB View (It is past the end of the MIB tree)
Note that this is a different response than with an invalid string; with an invalid string, queries just time out. With this (ACLed) string, 'public' simply has no allowed views. - Devices (and discovery) are configured with a *different* SNMP string which does actually work via a walk, but not via discovery.
Is there a way to change discovery behavior to try 'public' *last*? There doesn't appear to be an order in the SNMP Configuration that's relevant.
Is there a way to batch change configured SNMP communities on nodes? Batch 'properties' change doesn't seem to exist in the UI. Better yet, can I do this with NXSL? I'm not seeing an attribute that lets me check or set the SNMP community.
Thanks
-
Currently community strings are not sorted / prioritized. The value specified in node properties ('public' by default) is tried first, then server tries community strings from settings (in order in which the database returned the list).
There is no way to change community string from NXSL.
The only possible way for now is to use a Jython script launched by nxshell. -
Thank you, Filipp. Has anyone written such a script yet that you know of?
-
Here's an example of such script, that will change community string for all nodes, that have SNMP polling enabled
newAuthName = 'public2' for node in [o for o in session.getAllObjects() if isinstance(o, objects.Node)]: # filter all objects for objects.Node if (node.getFlags() & Node.NF_DISABLE_SNMP) = 0: # SNMP polling is not disabled if (node.getSnmpAuthName() != newAuthName): print('Processing node %s: changing community string from %s to %s' % (node.objectName, node.getSnmpAuthName(), newAuthName)) md = NXCObjectModificationData(node.objectId) md.setSnmpAuthName(newAuthName) session.modifyObject(md)The script is launched like this:
java -jar nxshell-3.1.241.jar script_name.pyThere are some examples of Jython scripts in netxms sources in src/client/nxshell/samples/
Some examples are also here: https://wiki.netxms.org/wiki/Using_nxshell_to_automate_bulk_operations
Documentation of API calls is here: https://www.netxms.org/documentation/javadoc/latest/overview-summary.html
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