IP/Mac Address lookup
-
Is it possible to do IP and Mac address lookups vi nxshell or other command line tools. I would like to be able to use a script to query where a particular mac address is connected with out having to log in using the client . I didnt see any options listed in the nxadm or in the nxshell api but I could have over looked something.
Thanks
-
Yes, it's possible to do with nxshell. Some examples:
find by mac:
import sys mac = sys.argv[1].upper() for node in [o for o in s.getAllObjects() if isinstance(o, objects.Node)]: interfaces = node.getAllChilds(objects.GenericObject.OBJECT_INTERFACE) for interface in interfaces: if mac in interface.getMacAddress().toString().upper(): print "%s(%d) - %s - %s" % (node.getObjectName(), node.getObjectId(), interface.getMacAddress(), interface.getIpAddressListAsString())find by ip:
import sys ip = sys.argv[1] for node in [o for o in s.getAllObjects() if isinstance(o, objects.Node)]: interfaces = node.getAllChilds(objects.GenericObject.OBJECT_INTERFACE) for interface in interfaces: for interface_ip in interface.getIpAddressList(): if ip in interface_ip.toString(): print "%s(%d) - %s - %s" % (node.getObjectName(), node.getObjectId(), interface.getMacAddress(), interface.getIpAddressListAsString())Sample session:
~/Development/netxms/src/java/nxshell/target (develop|…)% java -Dnetxms.server=127.0.0.1 -Dnetxms.login=admin -Dnetxms.password=netxms -jar nxshell-2.0-RC2.jar find_by_mac.py B2:00:1C:15:BC:E0 AirAlk.local(100) - B2:00:1C:15:BC:E0 - 0.0.0.0/0 ~/Development/netxms/src/java/nxshell/target (develop|…)% java -Dnetxms.server=127.0.0.1 -Dnetxms.login=admin -Dnetxms.password=netxms -jar nxshell-2.0-RC2.jar find_by_ip.py 127 AirAlk.local(100) - 00:00:00:00:00:00 - 127.0.0.1/8 -
-
-
-
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