Page 6 of 7
Re: check_mrtgtraf
Posted: Sat May 06, 2017 12:54 pm
by 455157
Greetings jmac,
sorry to jump in so late, but I noticed this thread and wanted to help explain something dwhitfield mentioned in his recent post, in case you're not familiar everything.
Nagios XI is paid version, but it also offers a *much* simpler (and free) way to try out things like monitoring and graphing ports with Nagios.
You can get it as a CentOS VM that you can run in VirtualBox:
https://support.nagios.com/kb/article.php?id=289
Like he said, it is free for 7 or less devices (hosts) too.
In XI, you just run the Switch&Router wizard, pick the ports to monitor and boooom- monitoring and graphs.
It will help you see the potential of Nagios & MRTG, and all you'll probably have to do is spin up a VM and follow the steps in a wizard to see results
It definitely helped me learn how Nagios Core all the related components and concepts worked, maybe it does the same for you!
Re: check_mrtgtraf
Posted: Mon May 08, 2017 9:04 am
by tgriep
If looks like the MRTG process is setup but you do not have any configuration files.
If you are running MRTG version mrtg-2.17.4
You can check that by running the following
If you are not running that version, you would have to upgrade to it to continue on.
Edit your /etc/mrtg/mrtg.cfg file and put the following line on the bottom
Then you will need to create the conf.d folder by running
Code: Select all
mkdir /etc/mrtg/conf.d
chmod 777 /etc/mrtg/conf.d
Then you will have to create a config file for the device you want to monitor and put it in the /etc/mrtg/conf.d/ folder. To do that run the following command to create the config file.
Code: Select all
/usr/bin/cfgmaker --show-op-down --noreversedns --zero-speed 100000000 [email protected]:161::::2 >/etc/mrtg/conf.d/192.168.1.10.cfg
The above assumes that the device has SNMP Version 2 enabled and that the community string is set to public.
See this link for more details in the cfgmaker command.
http://oss.oetiker.ch/mrtg/doc/cfgmaker.en.html
If all goes well, you should see mrtg log files in the /var/lib/mrtg folder.
If so, then try and run the check_mrtgtraf plugin and see if it works.
Any errors, please be as detailed as possible when posting them here.
Re: check_mrtgtraf
Posted: Mon May 08, 2017 4:41 pm
by jmac727
Hello,
I've done all those things. I've confirmed the device has SNMP v2 enabled and the community name is set to public.
I ran all the commands you posted this morning. There are log files in the /var/lib/mrtg folder.
It is still telling me it's unable to open the mrtg log file.
I have attached a the mrtg.txt debug file you normally ask for.
Re: check_mrtgtraf
Posted: Mon May 08, 2017 4:44 pm
by jmac727
I also adjusted the ip address you had to be the one to the switch that I am monitoring. I assume that is the case?
Re: check_mrtgtraf
Posted: Mon May 08, 2017 5:01 pm
by tgriep
What is telling you it's unable to open the mrtg log file?
Show the command you are running to generate the error.
The mrtg.txt file looks like the files are created but it looks like the cron job only ran once so you will have to wait for a few more runs to get valid data.
Are the .log files getting updated in the /var/lib/mrtg folder every 5 minutes?
Re: check_mrtgtraf
Posted: Mon May 08, 2017 5:11 pm
by jmac727
On Nagios itself. Picture attached.
Re: check_mrtgtraf
Posted: Mon May 08, 2017 5:27 pm
by dwhitfield
ll -d /var/lib/mrtg? If off centos now then you should use ls instead of ll.
Also, the output of ll without the -d. Both sets are important. The nagios user needs to have read access, so you want to see some r for read in the output.
Re: check_mrtgtraf
Posted: Tue May 09, 2017 8:22 am
by jmac727
The results of that:
Re: check_mrtgtraf
Posted: Tue May 09, 2017 9:09 am
by dwhitfield
Probably the directory is also owned by root, even though we didn't get the ll -d output.
Try this:
chown -R apache.nagios /var/lib/mrtg
Re: check_mrtgtraf
Posted: Tue May 09, 2017 9:28 am
by jmac727
The ll-d output was the very first line in the picture. I did the chown and still no dice.