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.
Phillyidol
Posts: 7
Joined: Sat Feb 29, 2020 11:26 pm

check_mrtgtraf: Unable to open MRTG log file

Post by Phillyidol »

(sigh) Hey all,

I know a few of you have heard this before, but...

New to Nagios, not that new to Linux. I've played around with Ubuntu, Debian, Fedora, and now Mint, which I been using as my personal PLEX server for over a year now (I liked Mint the best for PLEX, so...) and it works great.

Issue I'm having is the 'check_mrtgtraf: Unable to open MRTG log file' error after adding my home router to the config files (I want to add my other stuff next, but not until I've figured out my router). I've been searching online for about 3 days (including looked thru every post here with this issue) and so far have not found my 'exact' scenario.

I'm running Linux Mint 19.1 (so essentially Ubuntu 18) and just installed Nagios 4.4.5 (I actually installed 4.4.2, as that was the ver in the tutorial I used, and then upgraded)

Now I used a couple tutorials with installing...
- I followed this one to install Nagios: https://www.itzgeek.com/how-tos/linux/l ... nt-16.html
- I followed this one for MRTG: https://www.youtube.com/watch?v=ftutyWqzRCs

...and for the most part, everything installed as far as all pre-reqs (Apache2, PHP, etc,). The one thing I am finding tho is that I don't have quite a few of the files in the locations listed in some of the posts here to fix this error (i.e. don't have /etc/httpd/conf/mrtg.cfg, /var/log/mrtg.log, /usr/local/nagios/object/, etc.), I also don't see any of the '<router_IP>_1.log' log files in any of the locations I've read to check, so I'm guessing there's some part of the MRTG install that either didn't work, the tutorial I used was incomplete, or I just completely missed a configuration step (which is prob the real issue).

Anyway, I know there's no better place to ask this then here, so hoping someone can help. Thanks tons in advance for any assistance :D
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mrtgtraf: Unable to open MRTG log file

Post by Box293 »

This KB article is for Nagios XI however it has MRTG troubleshooting steps:

https://support.nagios.com/kb/article/n ... hs-29.html

Mainly this command is the most useful:

Code: Select all

LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Phillyidol
Posts: 7
Joined: Sat Feb 29, 2020 11:26 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by Phillyidol »

Thanks tons for the reply Box293.

I ran that cmd you sent, but nothing happened/changed. I'm thinking 'Nagios Core' installs files in dif locations that 'XI' (for example, for me the 'mrtg.cfg' file is under '/etc/', not '/etc/mrtg/')

I went thru that KB you sent (thanks as well for that), and again, in line with seeing posts that mention things I don't seem to have, the troubleshooting mentions a 'check_rrdtraf' plugin, however, I did a 'locate' cmd for it and that plugin isn't on my system, so thinking it's Nagios XI specific (???).

I'll keep reading thru the KB and see what else I can find, but if you have any other ideas, please pass them along.

Thanks much again for the reply :D
Phillyidol
Posts: 7
Joined: Sat Feb 29, 2020 11:26 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by Phillyidol »

Quick update (and correction)...

I saw I had a typo in that cmd (I altered it to match my location and messed up a character), so re-ran it and got this for output...

2020-03-02 18:45:32: WARNING: Could not match host:'public@localhost:' ref:'Name' key:'eno1'
2020-03-02 18:45:42: ERROR: Target[localhost_eno1][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
2020-03-02 18:45:42: ERROR: Target[localhost_eno1][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data

Not quite sure what this entails, so doing some lookups/research now.

One thing I've also been doing is trying to figure out all the actual config files I have, and am supposed to have, that Nagios Core uses, since I am finding posts that reference files/locations that just don't exist with my install/setup.

For my setup, the only file that I used/edited for both 'snmp' and 'mrtg' configs was here: /usr/local/nagios/etc/objects/switch.cfg (edited/added my router here)

...and the only 'nagios' config file I used/edited was here: /usr/local/nagios/etc/nagios.cfg (uncommented the 'router/switch' entry)

I've done a 'locate' for any mrtg.conf/cfg files, and here's what I found (.conf 1st)...

/etc/apache2/sites-available/mrtg.conf
/etc/apache2/sites-enabled/mrtg.conf
/var/lib/dpkg/info/mrtg.conffiles
/var/lib/dpkg/info/mrtg.config

...(and for .cfg)...

/etc/mrtg.cfg
/etc/mrtg.cfg.backup
/etc/nagios-plugins/config/mrtg.cfg
/usr/share/monitoring-plugins/templates-standard/mrtg.cfg
/var/lib/mrtg/_etc_mrtg.cfg

I viewed all of those locations/files to see what's in them, and other than the apache2 'mrtg.conf' locations where I pasted the 'VirtualHost' entries (as per a tutorial), and the default entries in the '/etc/nagios-plugins/config/mrtg.cfg', all the other mrtg.cfg files have nothing in them, so...

The only other files I touched (and have) was the '/etc/snmp/snmpd.conf' (pasted a set of entries for a tutorial) and '/usr/local/nagios/etc/objects/contacts.cfg' (added my email address)

That's pretty much it for what files/locations I've found/touched from the tutorials, so I'm guessing I'm probably missing a few steps ;)

Thanks again in advance for any assist :D
Phillyidol
Posts: 7
Joined: Sat Feb 29, 2020 11:26 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by Phillyidol »

P.S. I'm also reading up on MIB issues/locations possibly being a culprit (there's a lot of chatter about Debian being strict about these), so I ran this snmpwalk cmd...

snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex

...and got this...

Bad operator (INTEGER): At line 73 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU
Timeout: No Response from localhost


..., so did a lookup and found a note to edit that line (add a couple dashes before it), so I did then re-ran the cmd and got this

Expected "}" (EOF): At line 134 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU
: (is a reserved word): At line 134 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU
RFC1213-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
RFC1213-MIB::ipAdEntIfIndex.192.168.1.144 = INTEGER: 2


...and line 134 is just the end of the file (so below where it just says 'END' and that's it)

Not sure if that helps in any way, but figured I'd make a note
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mrtgtraf: Unable to open MRTG log file

Post by Box293 »

This is an example of the command used by MRTG to scan a device and generate a config:

Code: Select all

/usr/bin/cfgmaker --show-op-down --noreversedns --zero-speed '100000000' '<community>@<ip address>:::::2'
You need to change the community and ip address to match your device settings.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Phillyidol
Posts: 7
Joined: Sat Feb 29, 2020 11:26 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by Phillyidol »

Did a lookup for my router and apparently the default community string is 'public', so ran the cmd and am beginning to think this may be all for naught, as the initial output was 'SNMP Error: no response given'.

Did another lookup on my router (EA7500 AC1900) and it looks like it may not even have/support SNMP (still researching)

Just to ask, you said below the cmd would "generate a config". Where would it generate it (and name it)?

Thanks again
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_mrtgtraf: Unable to open MRTG log file

Post by scottwilkerson »

It would just output it

If you were satisfied with the output, and wanted to save it to a mrtg config file you would run it redirecting output to the file, such as

Code: Select all

/usr/bin/cfgmaker --show-op-down --noreversedns --zero-speed '100000000' '<community>@<ip address>:::::2' > /etc/mrtg/conf.d/<ip address>.cfg
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Phillyidol
Posts: 7
Joined: Sat Feb 29, 2020 11:26 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by Phillyidol »

Ah - ok,

Well just to post the output, here's what I got after running the cmd...

/usr/bin/cfgmaker --show-op-down --noreversedns --zero-speed '100000000' 'public@192.168.1.1:::::2'
--base: Get Device Info on public@192.168.1.1:::::2
SNMP Error:
no response received
SNMPv2c_Session (remote host: "192.168.1.1" [192.168.1.1].161)
community: "public"
request ID: 2145505123
PDU bufsize: 8000 bytes
timeout: 2s
retries: 5
backoff: 1)
at /usr/share/perl5/SNMP_util.pm line 651.
SNMPWALK Problem for 1.3.6.1.2.1.1 on public@192.168.1.1:::::2:v4only
at /usr/bin/cfgmaker line 960.
WARNING: Skipping public@192.168.1.1:::::2 as no info could be retrieved

Use of uninitialized value $comment_sysdescr in substitution (s///) at /usr/bin/cfgmaker line 384.
Use of uninitialized value $sysname in concatenation (.) or string at /usr/bin/cfgmaker line 417.
Use of uninitialized value $comment_sysdescr in concatenation (.) or string at /usr/bin/cfgmaker line 417.
Use of uninitialized value $syscontact in concatenation (.) or string at /usr/bin/cfgmaker line 417.
Use of uninitialized value $syslocation in concatenation (.) or string at /usr/bin/cfgmaker line 417.
# Created by
# /usr/bin/cfgmaker --show-op-down --noreversedns --zero-speed 100000000 public@192.168.1.1:::::2


### Global Config Options

# for UNIX
# WorkDir: /home/http/mrtg

# for Debian
WorkDir: /var/www/mrtg

# or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

# to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no

######################################################################
# System:
# Description:
# Contact:
# Location:
######################################################################


Now one question... What config file does that cmd pull the 'WorkDir' info from (you can see the 'Debian' one is uncommented)? I looked in the cfg/conf files I've mentioned/remembered editing (i.e nagios.cfg, snmpd.cfg, and switch.cfg), but none of them had any 'WorkDir' entries.

Reason I ask is when I did the mrtg tutorial, it made a change to the WorkDir location to '/var/www/html/mrtg', so based on what I see in the output, the config is wrong and I need to change it (might actually correct this bloody thing)

Thanks again
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_mrtgtraf: Unable to open MRTG log file

Post by scottwilkerson »

These are just MRTG defaults
We cannot really assist much with MRTG as it is not our project, but it looks like it could not connect based on the output.

MRTG documentation and resources can be found here
https://oss.oetiker.ch/mrtg/doc/
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked