Tech Tip: NV - Queries to get list of devices.

Document created by DavidM Employee on Sep 17, 2015
Version 1Show Document
  • View in full screen mode

From time to time there is a request for a query to provide a list of devices, so here are the most common one.

Note: If the query results in a syntax error copy it into Notepad first.

 

To get a list of certain types of devices.

Nexus

mysql nms2 -t -e "select dev_alias, dev_name from devices WHERE sys_descr LIKE '%%NX-OS%%' " > d:\nexusdevices.txt

Juniper

mysql nms2 -t -e "select dev_alias, dev_name from devices WHERE sys_descr LIKE '%%Juniper%%' " > d:\Juniperdevices.txt

or any other type just replace a character string common to all these devices between the %%xxxx%%, making sure to copy it exactly as shown in the Console Group tree since it is case sensitive.

 

# of devices with polling enabled or not

mysql nms2 -t -e "select count(*) from devices where poll_enable = '1'"

mysql nms2 -t -e "select count(*) from devices where poll_enable != '1'"

 

find devices with polling disabled

mysql nms2 -t -e "select dev_alias, dev_name from devices where poll_enable != 1" > d:\disabled-divices.txt

 

find devices with poll enabled or not, and non-snmp

mysql nms2 -t -e "select dev_alias, dev_name from devices where snmp_capable = 0 and poll_enable = 1" > d:\non-SNMP-enabled.txt

mysql nms2 -t -e "select dev_alias, dev_name from devices where snmp_capable = 0 and poll_enable != 1" > d:\non-SNMP-disabled.txt

 

list of all devices

mysql nms2 -t -e "select dev_alias, dev_name from devices" > d:\devices.txt

list of all devices with poll status.

mysql nms2 -t -e "select dev_alias, dev_name, poll_enable from devices" > d:\devices.txt

Only poll_enable=1 = Enabled.

 

If you want to run it at the MC including the poller which as the device.

mysql nms2 -t -e "select dev_alias, dev_name, poll_enable, dev_owner from devices" > D:\DeviceList.txt"

mysql nms2 -t -e "select smgr_id, smgr_host, smgr_addr from service_managers"

smgr_id = dev_owner

1 person found this helpful

Attachments

    Outcomes