How to add another switch/router with MRTG

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

How to add another switch/router with MRTG

Post by Jessuzz94 »

i have followed these steps to monior bandwidth of interfaces of one cisco switch and it works fine:

Code: Select all

mkdir /etc/mrtg

mv /etc/mrtg.cfg /etc/mrtg/

Now we run the cfgmaker command to get things up and running:

cfgmaker --global 'WorkDir:/var/www/mrtg' --global 'Options[_]: bits,growright' --output /etc/mrtg/mrtg.cfg public@<yourrouterip>

We need to make sure the following lines are correct in /etc/mrtg/mrtg.cfg If they are not there, add them.

EnableIPv6: no
RunAsDaemon: Yes
Interval: 5
Logdir: /var/log/mrtg

Now run:

indexmaker --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg

Which will build the index so you can view the output.

Then I run this command to set an environmental variable

env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

and open http://localhost/mrtg/index.html
but, iif i want now to add one router how can i do?, i tried to use the same steps but to the router ip and doesnt work
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How to add another switch/router with MRTG

Post by tgriep »

Do you have SNMP enabled and configured on the router?
Can you run the following from your Nagios system to see if the router has the SNMP port open? Replace xxx with the routers IP address.

Code: Select all

nmap xxx.xxx.xxx.xxx -sU -p 161
When you ran cfgmaker, did you receive any errors?
Can you post the errors?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to add another switch/router with MRTG

Post by Jessuzz94 »

Sorry now i can do, it just to change to other directory, example mrtg/router, and i put localhost/mrtg/router/index.html and shows the interface, but, very thanks!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How to add another switch/router with MRTG

Post by tgriep »

Is the problem solved now by going to the new link?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to add another switch/router with MRTG

Post by Jessuzz94 »

Yeah the problem is solved, just one question, for each device that i want to monitor (switch or router) , is the same mrtg.cfg?, for every devices that i want to add with the cfgmaker i put mrtg.cfg always?, or mrtg1.cfg, mrtg2.cfg, mrtg3.cfg,?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How to add another switch/router with MRTG

Post by tgriep »

Depending on the settings in the /etc/mrtg/mrtg.cfg file, you shouldn't have to add it to the cfgmaker command at all.
Can you post your mrtg.cfg file?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to add another switch/router with MRTG

Post by Jessuzz94 »

Ok, but i need to connect remotely to copy the the text
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How to add another switch/router with MRTG

Post by tgriep »

I found that you could just generate a different .cfg file with cfgmaker and append it to main config file or create a different cfg file and add that to your crontab file.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to add another switch/router with MRTG

Post by Jessuzz94 »

How add to my contab file?, you say the command line to start the mrtg daemon every 5 minutes?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How to add another switch/router with MRTG

Post by tgriep »

Without knowing how your system is setup, I cannot give you any details, but the crontab file that currently runs the mrtg command every 5 minutes needs to be edited and just duplicate the current command and change the name of the cfg file to the new on that you created.
Then restart the cron daemon and it should start collecting the data.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked