Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log file

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
solastek
Posts: 15
Joined: Thu Nov 19, 2015 5:49 am

Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log file

Post by solastek »

We have installed Nagios Xi 5.2.3 fresh on vmware using the ova template.
Imported config files for our switches.
The config files also has mrtg entries in it.
The configuration files are imported successfully
The lookup on the Dashboard shows.
Port 1 Bandwidth Usage:
(Name of the switch)

check_mrtgtraf: Unable to open MRTG log file
Usage check_mrtgtraf -F <log_file> -a <AVG

There are a few posts for Installation of MRTG installation for Nagios on Linux.
--------------------
yum install mrtg output shows
Package mrtg-2.16.2-7.el6.x86_64 already installed and latest version
Nothing to do
--------------------
Checked to see if mrtg direcory is available in /var/www/html/mrtg is available
There is no such directory
---------------------
Request your help in resolving this.
Rgds
Prashanth.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log f

Post by rkennedy »

Can you post the service definition for the service that is returning that error?
Former Nagios Employee
solastek
Posts: 15
Joined: Thu Nov 19, 2015 5:49 am

Re: Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log f

Post by solastek »

Like I was mentioning this is a new installation of nagiosxi 5.2.3
We have imported the switch configurations from a config file.
The import of the switch.cfg file was successful
the service Port1 Bandwidth Usage gives the error

"check_mrtgtraf: Unable to open MRTG log file
Usage check_mrtgtraf -F <log_file> -a <AVG "

Please find the printscreen attached.
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log f

Post by rkennedy »

Can you verify the permissions of the /var/www/mrtg/ directory and post the output?

Code: Select all

ls -l /var/www/mrtg/
Former Nagios Employee
solastek
Posts: 15
Joined: Thu Nov 19, 2015 5:49 am

Re: Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log f

Post by solastek »

Code: Select all

ls -l /var/www/mrtg
total 1540
-rw-r--r-- 1 root root  2051 Jan  7 09:00 172.16.24.5_10101-day.png
-rw-r--r-- 1 root root  6788 Jan  7 09:00 172.16.24.5_10101.html
-rw-r--r-- 1 root root 51142 Jan  7 09:00 172.16.24.5_10101.log
-rw-r--r-- 1 root root  1570 Jan  7 08:15 172.16.24.5_10101-month.png
-rw-r--r-- 1 root root 51138 Jan  7 08:55 172.16.24.5_10101.old
-rw-r--r-- 1 root root  1689 Jan  7 08:50 172.16.24.5_10101-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_10101-year.png
-rw-r--r-- 1 root root  1734 Jan  7 09:00 172.16.24.5_10102-day.png
-rw-r--r-- 1 root root  6718 Jan  7 09:00 172.16.24.5_10102.html
-rw-r--r-- 1 root root 49102 Jan  7 09:00 172.16.24.5_10102.log
-rw-r--r-- 1 root root  1552 Jan  7 08:15 172.16.24.5_10102-month.png
-rw-r--r-- 1 root root 49103 Jan  7 08:55 172.16.24.5_10102.old
-rw-r--r-- 1 root root  1565 Jan  7 08:50 172.16.24.5_10102-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_10102-year.png
-rw-r--r-- 1 root root  1879 Jan  7 09:00 172.16.24.5_10103-day.png
-rw-r--r-- 1 root root  6771 Jan  7 09:00 172.16.24.5_10103.html
-rw-r--r-- 1 root root 50261 Jan  7 09:00 172.16.24.5_10103.log
-rw-r--r-- 1 root root  1589 Jan  7 08:15 172.16.24.5_10103-month.png
-rw-r--r-- 1 root root 50260 Jan  7 08:55 172.16.24.5_10103.old
-rw-r--r-- 1 root root  1590 Jan  7 08:50 172.16.24.5_10103-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_10103-year.png
-rw-r--r-- 1 root root  1987 Jan  7 09:00 172.16.24.5_10104-day.png
-rw-r--r-- 1 root root  6760 Jan  7 09:00 172.16.24.5_10104.html
-rw-r--r-- 1 root root 50389 Jan  7 09:00 172.16.24.5_10104.log
-rw-r--r-- 1 root root  1631 Jan  7 08:15 172.16.24.5_10104-month.png
-rw-r--r-- 1 root root 50389 Jan  7 08:55 172.16.24.5_10104.old
-rw-r--r-- 1 root root  1654 Jan  7 08:50 172.16.24.5_10104-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_10104-year.png
-rw-r--r-- 1 root root  2507 Jan  7 09:00 172.16.24.5_10105-day.png
-rw-r--r-- 1 root root  6784 Jan  7 09:00 172.16.24.5_10105.html
-rw-r--r-- 1 root root 51003 Jan  7 09:00 172.16.24.5_10105.log
-rw-r--r-- 1 root root  1581 Jan  7 08:15 172.16.24.5_10105-month.png
-rw-r--r-- 1 root root 51002 Jan  7 08:55 172.16.24.5_10105.old
-rw-r--r-- 1 root root  1883 Jan  7 08:50 172.16.24.5_10105-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_10105-year.png
-rw-r--r-- 1 root root  2032 Jan  7 09:00 172.16.24.5_10109-day.png
-rw-r--r-- 1 root root  6765 Jan  7 09:00 172.16.24.5_10109.html
-rw-r--r-- 1 root root 50177 Jan  7 09:00 172.16.24.5_10109.log
-rw-r--r-- 1 root root  1620 Jan  7 08:15 172.16.24.5_10109-month.png
-rw-r--r-- 1 root root 50177 Jan  7 08:55 172.16.24.5_10109.old
-rw-r--r-- 1 root root  1653 Jan  7 08:50 172.16.24.5_10109-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_10109-year.png
-rw-r--r-- 1 root root  2468 Jan  7 09:00 172.16.24.5_24-day.png
-rw-r--r-- 1 root root  6674 Jan  7 09:00 172.16.24.5_24.html
-rw-r--r-- 1 root root 49678 Jan  7 09:00 172.16.24.5_24.log
-rw-r--r-- 1 root root  1593 Jan  7 08:15 172.16.24.5_24-month.png
-rw-r--r-- 1 root root 49689 Jan  7 08:55 172.16.24.5_24.old
-rw-r--r-- 1 root root  1858 Jan  7 08:50 172.16.24.5_24-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_24-year.png
-rw-r--r-- 1 root root  1841 Jan  7 09:00 172.16.24.5_2-day.png
-rw-r--r-- 1 root root  6616 Jan  7 09:00 172.16.24.5_2.html
-rw-r--r-- 1 root root 48281 Jan  7 09:00 172.16.24.5_2.log
-rw-r--r-- 1 root root  1464 Jan  7 08:15 172.16.24.5_2-month.png
-rw-r--r-- 1 root root 48294 Jan  7 08:55 172.16.24.5_2.old
-rw-r--r-- 1 root root  1498 Jan  7 08:50 172.16.24.5_2-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_2-year.png
-rw-r--r-- 1 root root  1978 Jan  7 09:00 172.16.24.5_401-day.png
-rw-r--r-- 1 root root  6484 Jan  7 09:00 172.16.24.5_401.html
-rw-r--r-- 1 root root 48224 Jan  7 09:00 172.16.24.5_401.log
-rw-r--r-- 1 root root  1423 Jan  7 08:15 172.16.24.5_401-month.png
-rw-r--r-- 1 root root 48241 Jan  7 08:55 172.16.24.5_401.old
-rw-r--r-- 1 root root  1620 Jan  7 08:50 172.16.24.5_401-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_401-year.png
-rw-r--r-- 1 root root  2041 Jan  7 09:00 172.16.24.5_601-day.png
-rw-r--r-- 1 root root  6490 Jan  7 09:00 172.16.24.5_601.html
-rw-r--r-- 1 root root 48257 Jan  7 09:00 172.16.24.5_601.log
-rw-r--r-- 1 root root  1472 Jan  7 08:15 172.16.24.5_601-month.png
-rw-r--r-- 1 root root 48274 Jan  7 08:55 172.16.24.5_601.old
-rw-r--r-- 1 root root  1656 Jan  7 08:50 172.16.24.5_601-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_601-year.png
-rw-r--r-- 1 root root  1775 Jan  7 09:00 172.16.24.5_801-day.png
-rw-r--r-- 1 root root  6484 Jan  7 09:00 172.16.24.5_801.html
-rw-r--r-- 1 root root 48218 Jan  7 09:00 172.16.24.5_801.log
-rw-r--r-- 1 root root  1406 Jan  7 08:15 172.16.24.5_801-month.png
-rw-r--r-- 1 root root 48235 Jan  7 08:55 172.16.24.5_801.old
-rw-r--r-- 1 root root  1500 Jan  7 08:50 172.16.24.5_801-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_801-year.png
-rw-r--r-- 1 root root  2097 Jan  7 09:00 172.16.24.5_901-day.png
-rw-r--r-- 1 root root  6496 Jan  7 09:00 172.16.24.5_901.html
-rw-r--r-- 1 root root 48569 Jan  7 09:00 172.16.24.5_901.log
-rw-r--r-- 1 root root  1494 Jan  7 08:15 172.16.24.5_901-month.png
-rw-r--r-- 1 root root 48586 Jan  7 08:55 172.16.24.5_901.old
-rw-r--r-- 1 root root  1715 Jan  7 08:50 172.16.24.5_901-week.png
-rw-r--r-- 1 root root  1733 Jan  6 17:40 172.16.24.5_901-year.png
-rw-r--r-- 1 root root   350 Nov 12  2012 favicon.ico
-rw-r--r-- 1 root root  5464 Jan  6 17:38 index.html
-rw-r--r-- 1 root root   343 Nov 12  2012 mrtg-l.gif
-rw-r--r-- 1 root root   538 Nov 12  2012 mrtg-l.png
-rw-r--r-- 1 root root  1144 Nov 12  2012 mrtg-m.gif
-rw-r--r-- 1 root root   414 Nov 12  2012 mrtg-m.png
-rw-r--r-- 1 root root  1779 Nov 12  2012 mrtg-r.gif
-rw-r--r-- 1 root root  1759 Nov 12  2012 mrtg-r.png
-rw-r--r-- 1 root root  4696 Nov 12  2012 mrtg-ti.gif
-rw-r--r-- 1 root root  4293 Nov 12  2012 mrtg-ti.png
Last edited by tmcdonald on Thu Jan 07, 2016 10:31 am, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log f

Post by tgriep »

Can you run the following in a command prompt on the Nagios server and post the output here? I want to see if the nagios user account can run the command.

Code: Select all

su nagios
/usr/local/nagios/libexec/check_mrtgtraf -F /var/www/mrtg/172.16.24.5_10101.log -a AVG -w 1000000,1000000 -c 5000000,5000000 -e 10
While you are logged in, can you run the following and post the output?

Code: Select all

ls -l /var
ls -l /var/www
Be sure to check out our Knowledgebase for helpful articles and solutions!
solastek
Posts: 15
Joined: Thu Nov 19, 2015 5:49 am

Re: Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log f

Post by solastek »

Please ignore the output of ls -l /var/www/mrtg sent to you on 7/01/2016 as this was sent to you from a previous working setup.
----------------------------------------
The new installation on nagiosxi 5.2.3 has the below output.

ls -l /var/www/mrtg
total 44
-rw-r--r-- 1 root root 350 Nov 12 2012 favicon.ico
-rw-r--r-- 1 root root 343 Nov 12 2012 mrtg-l.gif
-rw-r--r-- 1 root root 538 Nov 12 2012 mrtg-l.png
-rw-r--r-- 1 root root 1144 Nov 12 2012 mrtg-m.gif
-rw-r--r-- 1 root root 414 Nov 12 2012 mrtg-m.png
-rw-r--r-- 1 root root 1779 Nov 12 2012 mrtg-r.gif
-rw-r--r-- 1 root root 1759 Nov 12 2012 mrtg-r.png
-rw-r--r-- 1 root root 4696 Nov 12 2012 mrtg-ti.gif
-rw-r--r-- 1 root root 4293 Nov 12 2012 mrtg-ti.png
---------------------------------------
The output requested by you on Jan 8 are below.
====
su nagios
[nagios@nagios-11 mrtg]$ /usr/local/nagios/libexec/check_mrtgtraf -F /var/www/mrtg/172.16.24.5_10101.log -a AVG -w 1000000,1000000 -c 5000000,5000000 -e 10
check_mrtgtraf: Unable to open MRTG log file
Usage check_mrtgtraf -F <log_file> -a <AVG | MAX> -w <warning_pair>
-c <critical_pair> [-e expire_minutes]
======
======
ls -l /var
total 64
drwxr-xr-x. 9 root root 4096 Dec 8 22:50 cache
drwxr-xr-x. 3 root root 4096 Apr 5 2013 db
drwxr-xr-x. 3 root root 4096 Sep 23 2011 empty
drwxr-xr-x. 2 root root 4096 Sep 23 2011 games
drwxr-xr-x. 23 root root 4096 Jan 8 03:12 lib
drwxr-xr-x. 2 root root 4096 Sep 23 2011 local
drwxrwxr-x. 5 root lock 4096 Jan 8 03:12 lock
drwxr-xr-x. 8 root root 4096 Jan 7 16:58 log
lrwxrwxrwx. 1 root root 10 Apr 5 2013 mail -> spool/mail
drwxr-xr-x. 2 root root 4096 Sep 23 2011 nis
drwxr-xr-x. 2 root root 4096 Sep 23 2011 opt
drwxr-xr-x. 2 root root 4096 Sep 23 2011 preserve
drwxr-xr-x. 15 root root 4096 Jan 7 16:16 run
drwxr-xr-x. 9 root root 4096 Jan 5 14:15 spool
drwxrwxrwt. 2 root root 4096 Jan 5 14:15 tmp
drwxr-xr-x 7 root root 4096 Dec 8 22:50 www
drwxr-xr-x. 2 root root 4096 Sep 23 2011 yp
=====
=====
ls -l /var/www
total 20
drwxr-xr-x 2 root root 4096 Aug 24 23:23 cgi-bin
drwxr-xr-x 3 root root 4096 Dec 8 22:50 error
drwxr-xr-x 3 root root 4096 Dec 8 23:05 html
drwxr-xr-x 3 root root 4096 Dec 8 22:50 icons
drwxr-xr-x 2 root root 4096 Dec 8 22:50 mrtg
======
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log f

Post by tgriep »

It look like the new server may needs to have MRTG installed and / or configured on your new system.
If you still have access to the old server, the configs that need to be transferred should be in this folder /etc/mrtg
Be sure to check out our Knowledgebase for helpful articles and solutions!
solastek
Posts: 15
Joined: Thu Nov 19, 2015 5:49 am

Re: Error- OUTPUT: check_mrtgtraf: Unable to open MRTG log f

Post by solastek »

The issue is resolved.

I changed the permission for
/var/www/mrtg to nagios
by issuing the command
1) chown -R nagios:nagios mrtg

Then the cfgmaker commands below
2) cfgmaker --global 'WorkDir: /var/www/mrtg' --output /etc/mrtg/mrtg.cfg [email protected]
3) indexmaker --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg
4) env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log

crontab -e
*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log

The mrtg graphs are shown now.

Thanks for all the assistance.
Locked