check_mrtgtraf: Unable to open MRTG log file

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.
Locked
barry1946
Posts: 32
Joined: Wed Aug 14, 2013 11:29 am

check_mrtgtraf: Unable to open MRTG log file

Post by barry1946 »

I am receiving this error : check_mrtgtraf: Unable to open MRTG log file
while this is my servic econfiguration
define service{
use generic-service ; Inherit values from a template
host_name Babaee-Router-1
service_description Bandwidth Usage
check_command check_local_mrtgtraf!/var/lib/mrtg/router.log!AVG!1000000,1000000!5000000,5000000!10
name bandwidth-service
hostgroup_name switches,routers,firewalls
}

also I have created the /var/lib/mrtg/ directory and router.log file with chmod nagios.nagios
for now the nagios is installed on a virtual machine.

is there any idea how to solve it?
barry1946
Posts: 32
Joined: Wed Aug 14, 2013 11:29 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post by barry1946 »

I solved this issue myself and I wonder why nobody answered this.
first I needeed to install MRTG, in no manual i found this and I thought the mrtg plugin would do the job for me but it won't
then I have to configure mrtg like this:
((source is : http://www.cyberciti.biz/faq/centos-fed ... -tutorial/))

Use cfgmaker command to creates /etc/mrtg/mrtg.cfg file, enter:
# cfgmaker --global 'WorkDir: /var/www/mrtg' --output /etc/mrtg/mrtg.cfg public@localhost

--global 'WorkDir: /var/www/mrtg' : add global config entries i.e. set workdir to store MRTG graphs.
--output /etc/mrtg/mrtg.cfg: configr output filename
public@localhost : public is the community name of the device you want to create a configuration for. If you are using the wrong community name you will get no response from the device. localhost is the DNS name or the IP number of an SNMP-managable device i.e. our local server.
Finally, run indexmaker to create web pages which display the status of an array of mrtg interface status pages:
# indexmaker --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg

Step # 4: Verify Cron Job

/etc/cron.d/mrtg runs mrtg command to monitor the traffic load on network links:
# cat /etc/cron.d/mrtg

Sample Output:

*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
Just make sure crond is running and you are done with configuration:
# chkconfig --list crond

If it is off in run level # 3, just run the following to turn on crond service:
# chkconfig crond on
# service crond on



then I had to find that what is the log file for each interface by comparing the result of (ll /var/www/mrtg/ and the snmpwalk for the MIB)
and then create logfile in the services.cfg according to the files which is created in the /var/www/mrtg/for each interface and add the ip address in the description
I hope it helps others which are stuck in the middle of the way.
Thanks me :)
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by sreinhardt »

Thanks for the response and answer there! Sorry we do not work the weekends, and unfortunately this one happened to be a holiday in the states. If you have any other issues please let us know!
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.
Locked