Page 1 of 1
Rediscovery of Cisco router
Posted: Fri May 16, 2014 7:49 am
by dfmco
We are monitoring a number of Cisco devices that are changed frequently by other teams. I am unable to find a *rediscover* function so that I may re-read the snmp interface descriptions and find changed interfaces on the routers. I did attempt to run through the add router wizard again which seems to be a lot of extra work when I only need to rediscover interfaces and descriptions on changed interfaces that exist. Also, the rediscovery on v2014r1.0 did not find any interfaces on my router which is strange as it worked on 2012 but I see that is a known issue that is being worked.
My guess is there should be some trick or cli method to rediscover a device via SNMP. I did see a document describing re-running the wizard and hand editing a bunch of mrtg files but I can't imagine that there is not a cleaner way to do this.
(
http://assets.nagios.com/downloads/nagi ... Router.pdf)
CentOS with kernel 2.6.32-431.1.2.0.1.el6.x86_64 (from 2012 OVA)
Upgraded to 2014R1.0
Re: Rediscovery of Cisco router
Posted: Fri May 16, 2014 9:17 am
by slansing
Well, running the wizard again will essentially run a new SNMP walk against the device, which is what you would have to do in any case. All that it requires is Address, version, and community string, which are all things that could have changed and would be a reason a user would normally want to run the wizard against the same device again. That is currently what you would have to do. As far as editing MRTG configurations go, there is no real way around that at this point due to the way MRTG works and reads the configuration file. I know we have been looking at other avenues but for now we need to stick to the tried and true method.
Re: Rediscovery of Cisco router
Posted: Thu Jul 10, 2014 6:34 am
by dfmco
From a linux point of view, can you think of a way to script the removal from the mrtg file for a particular host? I am thinking that something like "sed" may be able to fine the entire sections of the mrtg file containing a certain hostname and delete them in one go. I am not an expert at programming but it sounds like that is something that could be scripted. If you have any ideas or a direction I can start looking, I would be glad to do the digging.
Re: Rediscovery of Cisco router
Posted: Thu Jul 10, 2014 6:42 am
by dfmco
AHHA!
So it seems that mrtg.cfg has an include line:
And that points to a directory with all the host IPs that are being monitored as separate cfg files. So I could write a script that does the following, correct?
Write shell script that takes an argument (host)
rm /usr/local/nagiosxi/tmp/mrtgscan* -f
rm -f /etc/mrtg/conf.d/<hostname passed in argument+.cfg>
Then I could re-run the wizard using the same hostname and IP and I would get all of the updated information. Is that correct?
Along those lines, could I also add this as a plugin to Nagios? I may be a long way off from accomplishing this but it would be an interesting exercise.
Re: Rediscovery of Cisco router
Posted: Thu Jul 10, 2014 11:59 am
by slansing
Actually, that would probably work just fine! Are you sure you'd want a plugin and not an event handler? You could trigger the event handler off a check that you run, the event handler would run your script, then you could get a notification telling you to re-run the wizard.