check_mrtgtraf

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.
455157
Posts: 51
Joined: Mon Sep 10, 2012 7:35 pm

Re: check_mrtgtraf

Post 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!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_mrtgtraf

Post 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

Code: Select all

env LANG=C /usr/bin/mrtg
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

Code: Select all

Include: conf.d/*.cfg
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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jmac727
Posts: 35
Joined: Tue Apr 25, 2017 4:37 pm

Re: check_mrtgtraf

Post 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.
Attachments
mrtg.txt
(158.66 KiB) Downloaded 296 times
jmac727
Posts: 35
Joined: Tue Apr 25, 2017 4:37 pm

Re: check_mrtgtraf

Post 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?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_mrtgtraf

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jmac727
Posts: 35
Joined: Tue Apr 25, 2017 4:37 pm

Re: check_mrtgtraf

Post by jmac727 »

On Nagios itself. Picture attached.
Attachments
checkmrtg.png
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_mrtgtraf

Post 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.
jmac727
Posts: 35
Joined: Tue Apr 25, 2017 4:37 pm

Re: check_mrtgtraf

Post by jmac727 »

The results of that:
Attachments
ll.png
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_mrtgtraf

Post 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
jmac727
Posts: 35
Joined: Tue Apr 25, 2017 4:37 pm

Re: check_mrtgtraf

Post by jmac727 »

The ll-d output was the very first line in the picture. I did the chown and still no dice.
Locked