Page 1 of 1

check_mrtgtraf: Unable to open MRTG log file

Posted: Sat Aug 31, 2013 2:32 am
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?

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Sun Sep 01, 2013 8:55 am
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 :)

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Tue Sep 03, 2013 10:45 am
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!