MRTG Issue w/ Nagios 4.0.6

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.
adamh0903
Posts: 4
Joined: Fri Oct 03, 2014 8:55 am

MRTG Issue w/ Nagios 4.0.6

Post by adamh0903 »

Ubuntu 14.04
Nagios 4.0.6

First let me say I have searched and researched this issue a lot and followed a lot of tutorials on fixes including one in this forum from a few days ago but nothing seems to fix my issue, there are so many links on the issue it should be an easy fix but I haven't been able to fix it yet. I think it is because I am missing a piece of the puzzle.

I have Nagios 4.0.6 up and running with nagiosgraph. My issue is with MRTG, I have it configured and working if I go to http://myserver/nagios/stats I am measuring data and I see graphs, but when I look at my hosts in nagios I see this


Port 1 Bandwidth Usage UNKNOWN 10-06-2014 19:22:25 0d 5h 37m 30s 3/3 check_mrtgtraf: Unable to open MRTG log file.



I know the issue is not being able to read my log file. My service definitions in switch.cfg is like this

# Monitor bandwidth via MRTG logs

define service{
use generic-service ; Inherit values from a template
hostgroup_name switches
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf!/var/lib/mrtg/10.42.0.7_1.log!AVG!1000000,1000000!5000000,5000000!10
}

There isnt a log file at /var/lib/mrtg/10.42.0.7_1.log so I know i am missing something. I just dont know enough about Linux / ubuntu to figure out where to look

thanks in advance everyone.
Twitter: @adamh0903 A+, Net+ CCNA
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MRTG Issue w/ Nagios 4.0.6

Post by sreinhardt »

This is generally caused when mrtg is either not logging to that location or is not able to pull bandwidth for that port. Do you have any files or folders in /var/lib/mrtg? What does your /etc/mrtg/mrtg.conf file look like?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
adamh0903
Posts: 4
Joined: Fri Oct 03, 2014 8:55 am

Re: MRTG Issue w/ Nagios 4.0.6

Post by adamh0903 »

The only file I have in /var/lib/mrtg is _usr_local_nagios_etc_mrtg.cfg


and my /etc/mrtg/mrtg.cfg file looks like this

Code: Select all

# Created by
# /usr/bin/cfgmaker --global WorkDir:/usr/local/nagios/share/stats --global "Options[_]: bits,growright" --output /etc/mrtg/mrtg.cfg [email protected]


### Global Config Options

#  for UNIX
# WorkDir: /home/http/mrtg

#  for Debian
WorkDir:/usr/loca/nagios/share/stats

#  or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no
RunAsDaemon: Yes
Interval: 5
Options[_]: bits,growright
logdir: /var/log/mrtg

######################################################################
# System: yh0209hp8212zl
# Description: HP J9091A Switch 8212zl, revision K.15.13.0005, ROM K.15.30 (/ws/swbuildm/K_rel_laredo_qaoff/code/build/btm(swbuildm_K_rel_laredo_qaoff_rel_laredo)) (Formerly ProCurve)
# Contact:
# Location:
######################################################################


### Interface 1 >> Descr: 'A1' | Name: 'A1' | Ip: 'No Ip' | Eth: '2c-59-e5-2b-b2-ff' ###

Target[10.42.132.5_A1]: #A1:[email protected]:
SetEnv[10.42.132.5_A1]: MRTG_INT_IP="No Ip" MRTG_INT_DESCR="A1"
MaxBytes[10.42.132.5_A1]: 12500000
Title[10.42.132.5_A1]: Traffic Analysis for A1 -- yh0209hp8212zl
PageTop[10.42.132.5_A1]: <h1>Traffic Analysis for A1 -- yh0209hp8212zl</h1>
                <div id="sysdetails">
                        <table>
                                <tr>
                                        <td>System:</td>
                                        <td>yh0209hp8212zl in </td>
                                </tr>
                                <tr>
                                        <td>Maintainer:</td>
                                        <td></td>
                                </tr>
                                <tr>
                                        <td>Description:</td>
                                        <td>A1  </td>
                                </tr>
                                <tr>
                                        <td>ifType:</td>
                                        <td>ethernetCsmacd (6)</td>
"mrtg.cfg" 10722L, 255165C                                                                                                                 1,1           Top

Twitter: @adamh0903 A+, Net+ CCNA
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MRTG Issue w/ Nagios 4.0.6

Post by sreinhardt »

OK for some reason your mrtg is set to log to a different directory. Let's check whats in /var/log/mrtg with:

Code: Select all

ls -lart /var/log/mrtg/
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: MRTG Issue w/ Nagios 4.0.6

Post by Box293 »

This MRTG file looks cut off and does not look complete.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
adamh0903
Posts: 4
Joined: Fri Oct 03, 2014 8:55 am

Re: MRTG Issue w/ Nagios 4.0.6

Post by adamh0903 »

the MRTG file is cut off i believe but it is very long, 15k rows before i stopped

here is the output

Code: Select all

root@DONETMON:/home/ahenderson# cd /
root@DONETMON:/# ls -lart /var/log/mrtg/
total 8
drwxr-x---  2 root adm    4096 May 19  2013 .
drwxrwxr-x 12 root syslog 4096 Oct 10 06:44 ..
Twitter: @adamh0903 A+, Net+ CCNA
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MRTG Issue w/ Nagios 4.0.6

Post by sreinhardt »

Don't worry about the whole file, you got most if not all the important details with the snippet provided! :) I find the permissions on your /var/log/mrtg folder a little interesting. Do you know what user you have mrtg running via your cron? Most likely that user does not currently have create or write permissions based on what I see here.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
adamh0903
Posts: 4
Joined: Fri Oct 03, 2014 8:55 am

Re: MRTG Issue w/ Nagios 4.0.6

Post by adamh0903 »

how would I go back and tell what user is running the cron job?
Twitter: @adamh0903 A+, Net+ CCNA
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: MRTG Issue w/ Nagios 4.0.6

Post by abrist »

adamh0903 wrote:how would I go back and tell what user is running the cron job?

Code: Select all

cat /etc/cron.d/mrtg
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
xsaithanx
Posts: 1
Joined: Wed Feb 03, 2016 11:12 am

Re: MRTG Issue w/ Nagios 4.0.6

Post by xsaithanx »

i have the same trouble, in my case root is the user wich run the cron job
Locked