check_mrtgtraf: Unable to open MRTG log file and Port 1 Link

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
seliimgnc
Posts: 14
Joined: Mon Mar 18, 2019 8:43 am

check_mrtgtraf: Unable to open MRTG log file and Port 1 Link

Post by seliimgnc »

Hi,
I want to monitoring switch with nagios but why nagios status information for Port 1 Bandwidth Usage>>> : check_mrtgtraf: Unable to open MRTG log file and Port 1 Link Status >>>> : External command error: MIB search path:


my switch.cfg file is :


define host {

use generic-switch ; Inherit default values from a template
host_name SO-1 ; The name we're giving to this switch
alias Sytem Room 1 ; A longer name associated with the switch
address 192.168.11.201 ; IP address of the switch
hostgroups switches ; Host groups this switch is associated with
}



# Monitor bandwidth via MRTG logs

define service {

use generic-service ; Inherit values from a template
host_name SO-1
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf!/var/lib/mrtg/192.168.1.253_1.log!AVG!1000000,1000000!5000000,5000000!10
}

define service {

use generic-service ; Inherit values from a template
host_name SO-1
service_description Port 1 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB
}
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_mrtgtraf: Unable to open MRTG log file and Port 1

Post by tgriep »

Does the following file exist on the Nagios server and it is readable by the nagios user account?

Code: Select all

/var/lib/mrtg/192.168.1.253_1.log
The plugin runs as nagios so that account needs to be able to read that file.

If the File does not exist, did you setup the MRTG application to log the bandwidth data to that file?

The MIB search path error, is the RFC1213-MIB MIB file installed on the server?
A typical location for the file is in the example below.

Code: Select all

/usr/share/snmp/mibs/RFC1213-MIB.txt
Be sure to check out our Knowledgebase for helpful articles and solutions!
seliimgnc
Posts: 14
Joined: Mon Mar 18, 2019 8:43 am

Re: check_mrtgtraf: Unable to open MRTG log file and Port 1

Post by seliimgnc »

tgriep wrote:Does the following file exist on the Nagios server and it is readable by the nagios user account?

Code: Select all

/var/lib/mrtg/192.168.1.253_1.log
It doesn't exist file. What should I now ?
root@ubuntu:/var/lib/mrtg# ls
_etc_mrtg.cfg



THIS IS _etc_mrtg.cfg
public@localhost_ Descr Microsoft Corporation Device 0003 2
public@localhost_ Descr lo 1
public@localhost_ Descr virbr0 3
public@localhost_ Descr virbr0-nic 4
public@localhost_ Eth 1
public@localhost_ Eth 00-15-5d-0a-0a-23 2
public@localhost_ Eth 52-54-00-b7-87-a5 Dup
public@localhost_ Ip 127.0.0.1 1
public@localhost_ Ip 192.168.10.45 2
public@localhost_ Ip 192.168.122.1 3
public@localhost_ Name eth0 2
public@localhost_ Name lo 1
public@localhost_ Name virbr0 3
public@localhost_ Name virbr0-nic 4
public@localhost_ Type 24 1
public@localhost_ Type 6 Dup







The plugin runs as nagios so that account needs to be able to read that file.

If the File does not exist, did you setup the MRTG application to log the bandwidth data to that file?

The MIB search path error, is the RFC1213-MIB MIB file installed on the server?
A typical location for the file is in the example below.

Code: Select all

/usr/share/snmp/mibs/RFC1213-MIB.txt

root@ubuntu:/usr/share/snmp/mibs# ls
GNOME-SMI.txt IANA-LANGUAGE-MIB.txt miblist.txt NET-SNMP-EXTEND-MIB.txt NET-SNMP-PASS-MIB.txt NET-SNMP-TC.txt SNMP-TLS-TM-MIB.txt UCD-DISKIO-MIB.txt UCD-IPFWACC-MIB.txt
IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt IANA-RTPROTO-MIB.txt NET-SNMP-AGENT-MIB.txt NET-SNMP-MIB.txt NET-SNMP-PERIODIC-NOTIFY-MIB.txt NET-SNMP-VACM-MIB.txt SNMP-TSM-MIB.txt UCD-DLMOD-MIB.txt UCD-SNMP-MIB-OLD.txt
IANAifType-MIB.txt LM-SENSORS-MIB.txt NET-SNMP-EXAMPLES-MIB.txt NET-SNMP-MONITOR-MIB.txt NET-SNMP-SYSTEM-MIB.txt RFC-1215.txt UCD-DEMO-MIB.txt UCD-IPFILTER-MIB.txt UCD-SNMP-MIB.txt
This my MIB file .
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_mrtgtraf: Unable to open MRTG log file and Port 1

Post by tgriep »

The missing file from the /var/lib/mrtg folder is a MRTG issue and the following link is the wed site for that application.
https://oss.oetiker.ch/mrtg/
Check the documentation link for troubleshooting steps and how to setup MRTG and run it.
Look at the mrtg-unix-guide.

You may need to run the cfgmaker to create the config for that device to ass the settings to MRTG.

I see that you are running ubuntu. The MIB file is in this folder on a ubuntu 18 system. Make sure it exists.

Code: Select all

/var/lib/mibs/ietf/RFC1213-MIB
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked