Page 1 of 1
check_mrtgtraf: Unable to open MRTG log file
Posted: Tue Nov 26, 2019 7:28 am
by sophisticated
Hi!
I have problem with MRTG. It works correctly wen i come in 192.168.3.22/mrtg It shows me Traffic Analysis of my firewall but in Nagios i have a unknown error: check_mrtgtraf: Unable to open MRTG log file
Code: Select all
# Monitor bandwidth via MRTG logs
define service {
use generic-service ; Inherit values from a template
host_name firewall
service_description Port 1 Bandwidth Usage
check_command check_mrtgtraf!/var/www/mrtg/192.168.3.6_40.log!AVG!1000000,1000000!5000000,5000000!10
}
Re: check_mrtgtraf: Unable to open MRTG log file
Posted: Tue Nov 26, 2019 3:06 pm
by cdienger
Does /var/www/mrtg/192.168.3.6_40.log exist? What permissions are set on it?
Re: check_mrtgtraf: Unable to open MRTG log file
Posted: Wed Nov 27, 2019 3:08 am
by sophisticated
cdienger wrote:Does /var/www/mrtg/192.168.3.6_40.log exist? What permissions are set on it?
Yes.
EDIT:
Oh, actually 192.168.3.6_40.log do not exist, i changed it to 192.168.3.6_10.log. Now is "MRTG data has expired (2641 minutes old)"
What should the number be in X 192.168.3.6_X.log?
Re: check_mrtgtraf: Unable to open MRTG log file
Posted: Wed Nov 27, 2019 12:30 pm
by cdienger
You may want to try using the rrdtool logformat instead to store the data and avoid having logs rotate/rollover:
https://oss.oetiker.ch/mrtg/doc/mrtg-rrd.en.html
Re: check_mrtgtraf: Unable to open MRTG log file
Posted: Wed Nov 27, 2019 3:15 pm
by sophisticated
Ok. When i try to install it shows me:
rrdtool is already the newest version (1.7.0-1build1).
librrds-perl is already the newest version (1.7.0-1build1).
But. Directory /usr/local/rrdtool/bin/ do not exist
Re: check_mrtgtraf: Unable to open MRTG log file
Posted: Wed Nov 27, 2019 3:48 pm
by cdienger
Run "which rrdtool" or "locate "rrdtool" to help find it. That said, if it's already installed I think all you need to do is modify the mrtg to look like:
Code: Select all
HtmlDir: /var/www/mrtg
ImageDir: /var/www/mrtg
LogFormat: rrdtool
LogDir: /var/lib/mrtg
ThreshDir: /var/lib/mrtg
WorkDir: /var/lib/mrtg
Forks: 4
EnableSnmpV3: yes
Include: conf.d/*.cfg
EnableSNMPv3: yes
And them modify the check_command to point at the rrd file instead of the .log file.
Re: check_mrtgtraf: Unable to open MRTG log file
Posted: Wed Nov 27, 2019 5:35 pm
by sophisticated
Do I have to add it to mrtg.cfg? Why my file is called mrtg.cfg.orig ?
Re: check_mrtgtraf: Unable to open MRTG log file
Posted: Mon Dec 02, 2019 3:38 pm
by cdienger
I don't know where else it would be changed, but mrtg.cfg(or which everconfig file your system is using) is the usual place it is defined.
The mrtg on my system runs every 5 minutes per a cronjob and defines the mrtg.cfg file to use:
Code: Select all
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lib/mrtg/mrtg.lock --confcache-file /var/lib/mrtg/mrtg.ok --user=nagios --group=nagios