Page 1 of 1

How to M/A/C an interface for a Cisco router

Posted: Tue Apr 14, 2015 6:35 pm
by dflick
I have several Cisco 2800 series routers that we are moving the serial ports to another interface to provide redundancy. Each router has (2) two port T1 cards. We are moving the second T1 from card 1 port 2 to card 2 port 1. The customer does not want to loose any of the historical information for that T1 that is moving so I can't delete and re-add. I have tried running a discovery in the past using the same name but that always deletes all historical data as well. How can I point Nagios to the T1 in the new port while keeping the historical.

In a related question, we also are adding some T1s to other sites and I have the same issue. How can I add a T1 and not loose historical data?

I am not afraid of hand editing files but I would like to be able to turn this task over to a junior admin and I hate to have him editing rrd files and such. I am hoping there is an easy solution.

Running 2014 R2.6 on CentOS 6.5

Re: How to move an interface for a monitored Cisco router

Posted: Tue Apr 14, 2015 6:50 pm
by Box293
It's not as complex as you might think.

First, you can manually edit the MRTG switch config file in /etc/mrtg/conf.d/ip_address.cfg

You could find the existing port and change it to the new port.

OR you could run the command that is documented at the beginning of the file to create a new config and output it to a new file

Code: Select all

the command -o /tmp/output.cfg
Then you could find the new port and add it to the existing config file.

Next, in CCM simply duplicate the existing service and rename it to the new port and update it so that references the new .rrd file that is polled.

Let the check run a couple of times to collect some data so the new .rrd file is created.

Finally, to move the historical data, simply use my "Performance Data Tool".

http://exchange.nagios.org/directory/Ad ... ol/details

Upload it into Nagios XI via Admin > System Extensions > Manage Components.

Then you can access it under the Tools menu.

You can use the Merge functionality to copy the existing data in the OLD RRD file to the newly created RRD file.

Simples :)

Let me know if this doesn't make sense or need more help.

Re: How to move an interface for a monitored Cisco router

Posted: Tue Apr 14, 2015 8:08 pm
by dflick
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!

Re: How to move an interface for a monitored Cisco router

Posted: Tue Apr 14, 2015 8:28 pm
by dflick
***UPDATE***
I had to fix interface 11 in the GUI replacing the 11 with 10 as mentioned above. Editing the rrd did not work properly. YMMV

I found that Performance-tools may be a bit laggy as I had to refresh the table a few times to find the new and old interfaces. For those that want to attempt go to Tools > Tools by box293 > Performance Data Tool > Merge > Merge specific rrd's > Choose source device > click refresh table > Choose the radio button for the old interface > Choose destination device > click refresh table > Choose the radio button for the new interface > choose "add source and destination to merge list" and click Perform action > THEN you should get a button to Perform Merge. Click that and you are done.

I tried an alternate method which seems to work better and is all GUI. Maybe a little tough for a junior admin but maybe OK....

I tried just a straight copy of the service and renumbering of the check arguments. I have an interesting issue though that I can't get performance data on the new interface even though I can see data for the counters on the router. Nagios shows zero in/out. Any idea hos to troubleshoot the mrtg portion?

Re: How to move an interface for a monitored Cisco router

Posted: Tue Apr 14, 2015 8:44 pm
by Box293
Yeah it's a little complicated :lol:

Glad you got there in the end. Yes I agree there must be a better way of doing this.

Re: How to M/A/C an interface for a Cisco router

Posted: Thu Apr 16, 2015 8:53 am
by rseiwert
I have an interesting issue though that I can't get performance data on the new interface even though I can see data for the counters on the router. Nagios shows zero in/out. Any idea hos to troubleshoot the mrtg portion?
If you go to advanced tab in XI do you see the performance data?
FYI, the processing of performance data is not realtime so you might have to wait a moment or two before perfdata is batched in and new data shows up on performance graphs . Also RRD requires a little bit of data before it starts showing actual numbers so on a new service you might have to wait several check cycles.