This query will take all the devices in the devices table that have
the same name and output a table with the names plus the number of times
they are listed in the database. This can be good for identifying
duplicate poll instances or just to determine if multiple devices have
the same hostnames.
mysql -H -D nms2 -e "select dev_alias, count(dev_alias) As NumOccurrences from devices
where model_id !=0 Group by dev_alias having (count(dev_alias) > 1);" > duplicatename.txt
This query will include the name of the one of the pollers it is residing on
mysql -D nms2 -e "select d.dev_alias, s.smgr_host count(dev_alias) As NumOccurrences from devices d, service_managers s where
where d.dev_owners=s.smgr_id Group by dev_alias having (count(dev_alias) > 1);" > duplicatename.txt
No comments:
Post a Comment