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
sophisticated
Posts: 13
Joined: Wed Nov 20, 2019 3:03 pm

check_mrtgtraf: Unable to open MRTG log file

Post 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
}
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post by cdienger »

Does /var/www/mrtg/192.168.3.6_40.log exist? What permissions are set on it?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sophisticated
Posts: 13
Joined: Wed Nov 20, 2019 3:03 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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?
Attachments
permissions
permissions
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sophisticated
Posts: 13
Joined: Wed Nov 20, 2019 3:03 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sophisticated
Posts: 13
Joined: Wed Nov 20, 2019 3:03 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by sophisticated »

Do I have to add it to mrtg.cfg? Why my file is called mrtg.cfg.orig ?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked