First off, HUGE thanks to BOX293 for pointing me in the right direction. I asked a similar question last year but was unable to follow the directions at all as they were far too vague. I am old to Linux but fairly new to Nagios. BOX293's high level tasks were exactly what I needed to get through the task!
BUT WOW! It is MUCH MORE COMPLEX than I thought! LOL! That is definitely not something I would get a junior admin to try! As a Cisco CCIE, I had some trouble following this! Is there no tool that can make this easier? I was hoping for a one button "Rediscover device" like I have used on many other monitoring systems! Oh well.....
Since I had no luck finding an answer to this problem in the forum doing a search, I figured I would post a step by step for those trying the same thing.
Here is what I did:
I ran the command at the top of the 10.102.255.207.cfg file in the /etc/mrtg/conf.d directory:
/usr/bin/cfgmaker --show-op-down --zero-speed=100000000 --snmp-options=:::::2 --noreversedns
[email protected] -o /tmp/output.cfg
note: I just left it at output.cfg so I would not have a bunch of extraneous files at the end. I have to add over 100 of these!
Then I went to the router to get the interface ID:
Router#sh snmp mib ifmib ifindex
I found the one I was looking for:
Serial0/1/0:0: Ifindex = 12
Then I opened the /tmp/output.cfg to find the section for Interface 12:
more /tmp/output.cfg
Here is an example of what that looks like:
Code: Select all
### Interface 12 >> Descr: 'Serial0/1/0:0' | Name: 'Se0/1/0:0' | Ip: '' | Eth: '' ###
Target[10.102.255.207_12]: 12:REDACTED\@[email protected]:::::2
noHC[10.102.255.207_12]: yes
SetEnv[10.102.255.207_12]: MRTG_INT_IP="" MRTG_INT_DESCR="Serial0/1/0:0"
MaxBytes[10.102.255.207_12]: 192000
Title[10.102.255.207_12]: Traffic Analysis for 12 -- Leander_PD
PageTop[10.102.255.207_12]: <h1>Traffic Analysis for 12 -- Router</h1>
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>Router in </td>
</tr>
<tr>
<td>Maintainer:</td>
<td>REDACTED</td>
</tr>
<tr>
<td>Description:</td>
<td>Serial0/1/0:0 ATT blah blah blah </td>
</tr>
<tr>
<td>ifType:</td>
<td>ppp (23)</td>
</tr>
<tr>
<td>ifName:</td>
<td>Se0/1/0:0</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>192.0 kBytes/s</td>
</tr>
</table>
</div>
Once I had that, I opened the live cfg file to edit:
vi /etc/mrtg/conf.d/10.102.255.207.cfg
I then had to comment out the old interface (11):
I put my cursor at the beginning of the line for interface 11 and then <shift>-v to select and arrow down to the bottom of the section. Then I added the hash to comment out the old interface:
:s/^/#/
Then, I had to insert the text from the output.cfg. I scrolled up to the "more" output and copy then back down to VI and <esc>a to add the lines and pasted.
I then saved the file:
:wq!
I then went into the GUI to Configure > Core Config Manager > Services and searched for my device. I selected the Bandwidth and Status services and copied.
I then selected the individual services and changed the Config Name, Description and $ARG1$ to the correct port number as shown by the Cisco CLI command above for bandwidth:
$ARG1$ 10.102.255.207_11.rrd Changed to 10.102.255.207_12.rrd
For status, I repeated the process but here I has to change $ARG2$ from 11 to 12.
I then had to save then set both to active by clicking on the red NO in the services list. Then I had to apply the configuration.
My interface 10 is now missing as well and interface 11 (which is the one that I disabled by adding the # in front of that section) is showing up as an active outage!
Please let me know what you need to troubleshoot this issue of the incorrect interfaces.
So doing this once is a bit of a nightmare and has the potential to be riddled with errors. There is NO WAY I would have a junior admin do this. There MUST be an easier way to accomplish this task. I can't imagine running through this for 100 more changes!
Any ideas are welcome. I did request a feature enhancement last year to add a "rediscover" function but there seems to be no traction on that.
I hope this helps others. Thanks!