Page 1 of 1

check_mrtgtraf

Posted: Thu Feb 09, 2012 4:58 pm
by ViaNagios
I am trying to monitor a Cisco 2960g switch and I am getting this error:

Port 1 Bandwidth Usage UNKNOWN 02-09-2012 16:51:03 148d 7h 41m 28s 3/3 check_mrtgtraf: Unable to open MRTG log file

Can anyone give me a clue as to what to check? I searched online and found things like, check directory permissions, etc. Nothing worked.
If I'm not posting to the correct place, please let me know where I can post.

Thanks, Thomy

Re: check_mrtgtraf

Posted: Thu Feb 09, 2012 5:07 pm
by nscott
Does the rrd file exist? What are the permissions on it? Do you have SELinux disabled?

Re: check_mrtgtraf

Posted: Fri Feb 10, 2012 10:54 am
by ViaNagios
Thanks so much for the quick reply!

In /var/nagios/ I have:
perfdata.log -rw-rw-r-- (664)
rrd drwxr-xr-x (755) (nothing in that directory)

Not sure about SELinux

FYI - I have installed:
Ubuntu server 8.04.4 LTS
Nagios 3.3.1
Nagios-Plugins 1.4.15
mrtg 2.17.4
nagiosgraph 1.4.4

Re: check_mrtgtraf

Posted: Fri Feb 10, 2012 11:10 am
by ViaNagios
Oh, and the nagios directory /var/nagios itself has drwxr-xr-x
user nagios, group nagios

Re: check_mrtgtraf

Posted: Fri Feb 10, 2012 12:09 pm
by nscott
So you've edited your mrtg.cfg? Is there a WorkDir and LogDir specified in the mrtg.cfg? That where mrtg is going to try and put the log files, so if they aren't being created by MRTG then thats where the troubleshooting should probably start.

Also I was mistaken about SELinux, Ubuntu using AppArmor.

Re: check_mrtgtraf

Posted: Fri Feb 10, 2012 1:18 pm
by ViaNagios
Yeah, no SELinux here.

Now I'm confused. I thought I did edit the mrtg.cfg . Upon searching I found I have 2.
One at /etc/ and the other at /etc/mrtg/ .

The one at /etc/ says:
######################################################################
# Multi Router Traffic Grapher -- Sample Configuration File
######################################################################
# This file is for use with mrtg-2.5.4c

# Global configuration
WorkDir: /var/www/mrtg
WriteExpires: Yes

Title[^]: Traffic Analysis for

# 128K leased line
# ----------------
#Title[leased]: a 128K leased line
#PageTop[leased]: <H1>Our 128K link to the outside world</H1>
#Target[leased]: 1:[email protected]
#MaxBytes[leased]: 16000


The one at /etc/mrtg/ says:
######################################################################
# Multi Router Traffic Grapher -- Sample Configuration File
######################################################################
# This file is for use with mrtg-2.5.4c

# Global configuration
RunAsDaemon: Yes
Interval: 5
Options[_]: growright, bits
WorkDir: /var/www/mrtg
Logdir: /var/log/
EnableIPv6: No
WriteExpires: Yes

Title[^]: Traffic Analysis for

# 128K leased line
# ----------------
#Title[leased]: a 128K leased line
#PageTop[leased]: <H1>Our 128K link to the outside world</H1>
#Target[leased]: 1:[email protected]
#MaxBytes[leased]: 16000

Which is the right one to configure? Where should WorkDir point? Where should Logdir point? In my instance. Sorry, noob with Nagios, and kinda noob with Linux in general.
They both say # This file is for use with mrtg-2.5.4c . Does it matter I have mrtg-2.14.7 (after running dpkg --list)?

Re: check_mrtgtraf

Posted: Fri Feb 10, 2012 3:03 pm
by ViaNagios
When searching for mrtg I get:

/var/lock/mrtg
/var/www/mrtg
/var/log/mrtg
/var/lib/mrtg
/usr/share/doc/mrtg
/usr/bin/mrtg
/etc/mrtg
/etc/logrotate.d/mrtg
/etc/cron.d/mrtg

Thanks,
Thomy

Re: check_mrtgtraf

Posted: Sat Feb 11, 2012 5:35 pm
by nscott
I don't think it matters where the mrtg.cfg is just as long as the mrtg command gets executed with the proper address for the config file. The Dir's indicated whichever config file you are launching mrtg with better exist. However I'm unsure if you're running mrtg as a daemon or hae the mrtg on some sort of cron job.