No file called /usr/local/nagios/etc/objects/switch.cfg

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
perric
Posts: 161
Joined: Fri Mar 28, 2014 10:37 am

No file called /usr/local/nagios/etc/objects/switch.cfg

Post by perric »

Hello,

The following techtip for managing routers/switches mentioned uncommenting the nagios.cfg line of #cfg_file=/usr/local/nagios/etc/objects/switch.cfg. This line doesn't exist in my nagios.cfg file and the switch.cfg file doesn't exist in the objects folder.

Techtip I am following - http://nagios.sourceforge.net/docs/3_0/ ... uters.html

I found these...

./local/nagiosxi/html/includes/configwizards/switch/templates/switch.cfg
./local/PreUpgrade/usr/local/nagiosxi/html/includes/configwizards/switch/templates/switch.cfg

Do I copy them into the "objects" folder and add an entry to the nagios.cfg file? Do I even need to do this? I want to setup alerts via SNMP Traps on Warnings/Debugs from my switches and routers.

David
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: No file called /usr/local/nagios/etc/objects/switch.cfg

Post by tmcdonald »

The document you are referencing is in regards to Nagios Core. For Nagios XI SNMP trap integration, please take a look at this doc:

http://assets.nagios.com/downloads/nagi ... ios_XI.pdf
Former Nagios employee
perric
Posts: 161
Joined: Fri Mar 28, 2014 10:37 am

Re: No file called /usr/local/nagios/etc/objects/switch.cfg

Post by perric »

Thanks. I followed the wizard from the doc, but I was not able to receive any traps from my Cisco 1921 router. When I did a test using the check_xi_service_snmp command, I get the following:

COMMAND: /usr/local/nagios/libexec/check_snmp -H 192.168.56.5 -C XXXXXX
OUTPUT: SNMP problem - No data received from host
CMD: /usr/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] 192.168.56.5:161

I see that there are troubleshooting steps, but it looks like more configuration is needed:

1. Noticed that the Wizard didn't add a check commands (when I viewed, via the GUI, the service I created with the Wizard) - do I need to specify check_xi_service_snmp to poll periodically or will Nagios listen for traps? Also, what is the difference between check_xi_service_snmp and the check_snmp command?

2. The doc talks about specifying a MIB - will any of the existing MIBs work (ex: SNMP-COMMUNITY-MIB.txt) for standard traps on a Cisco router or do I need the specific router MIB from Cisco?

3. How do I specify additional arguments using check_xi_service_SNMP like specifying the MIB? The GUI only seems to pass one argument ($ARG1$), which I used to specify the community string.

David
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: No file called /usr/local/nagios/etc/objects/switch.cfg

Post by slansing »

You've got active SNMPT GET requests and traps confused. Traps are passively received from your snmp trap enabled devices (if configured properly on their end). Active GET requests are ran from the XI server to query the SNMP tables on remote hosts which have it enabled. We need to take a step back and find out exactly what you are trying to accomplish, which of the methods above are you wanting to use?
perric
Posts: 161
Joined: Fri Mar 28, 2014 10:37 am

Re: No file called /usr/local/nagios/etc/objects/switch.cfg

Post by perric »

Ok. Still learning how Nagios works. When I check the snmpttunknown log, I see several messages like the following:

Thu Nov 6 16:21:58 2014: Unknown trap (.1.3.6.1.2.1.14.16.2.0.12) received from 192.168.83.5 at:
Value 0: 192.168.83.5
Value 1: 192.168.83.5
Value 2: 0:0:02:42.88
Value 3: .1.3.6.1.2.1.14.16.2.0.12
Value 4: 192.168.83.5
Value 5: XXXXXX
Value 6: .1.3.6.1.2.1.14.16.2
Value 7:
Value 8:
Value 9:
Value 10:
Ent Value 0: .1.3.6.1.2.1.14.1.1=192.168.83.5
Ent Value 1: .1.3.6.1.2.1.14.4.1.1=0.0.0.0
Ent Value 2: .1.3.6.1.2.1.14.4.1.2=5
Ent Value 3: .1.3.6.1.2.1.14.4.1.3=10.18.0.0
Ent Value 4: .1.3.6.1.2.1.14.4.1.4=192.168.83.5

When I try to add certain MIBS, i get the following

addmib /usr/share/snmp/mibs/IANAifType-MIB.myCannot find module (CISCO-OSPF-MIB): At line 40 in /usr/share/snmp/mibs/CISCO-OSPF-TRAP-MIB.my
Did not find 'cospfAreaNssaTranslatorState' in module #-1 (/usr/share/snmp/mibs/CISCO-OSPF-TRAP-MIB.my)
Did not find 'cospfShamLinkAreaId' in module #-1 (/usr/share/snmp/mibs/CISCO-OSPF-TRAP-MIB.my)
Did not find 'cospfLsdbType' in module #-1 (/usr/share/snmp/mibs/CISCO-OSPF-TRAP-MIB.my)
Did not find 'cospfShamLinkLocalIpAddress' in module #-1 (/usr/share/snmp/mibs/CISCO-OSPF-TRAP-MIB.my)

When I try to remove this MIB (CISCO-OSPF-TRAP-MIB.my) from the GUI (to retry the install), it says "MIB delete failed - directory permissions may be incorrect."

is there a manual process to remove the MIBs?

David
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: No file called /usr/local/nagios/etc/objects/switch.cfg

Post by abrist »

Yes. Remove the mib from:

Code: Select all

/usr/share/snmp/mibs/
What are that directory's permissions?

Code: Select all

ls -la /usr/share/snmp/mibs/
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
perric
Posts: 161
Joined: Fri Mar 28, 2014 10:37 am

Re: No file called /usr/local/nagios/etc/objects/switch.cfg

Post by perric »

Sure. Directory permissions:

drwxr-xr-x. 2 root root 4096 Nov 6 16:51 .
drwxr-xr-x. 5 root root 4096 Nov 6 11:49 ..
-rw------- 1 root root 22181 Nov 6 15:27 CISCO-OSPF-TRAP-MIB.my

Would I need to remove the converted or associated (via addmib) SNMP MIBs from Nagios also?

David
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: No file called /usr/local/nagios/etc/objects/switch.cfg

Post by lmiltchev »

Run the following commands:

Code: Select all

chown -R root:nagios /usr/share/snmp/mibs/
chmod 664 /usr/share/snmp/mibs/*
Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
perric
Posts: 161
Joined: Fri Mar 28, 2014 10:37 am

Re: No file called /usr/local/nagios/etc/objects/switch.cfg

Post by perric »

Hello,

I have added every MIB that seems appropriate, including ones that appeared as unknown in the snmpttunknown.log file.

But, I am still not receiving traps. For example, I did a reboot, which should show traps on a restart, OSPF events, etc. When I check the service for one of my devices, I see the following:

Service State:Ok
Duration:1d 0h 53m 35s
State Type:Hard
Current Check:1 of 1
Last Check:2014-11-06 12:28:24
Next Check:Not scheduled
Last State Change:014-11-06 11:58:32
Last Notification:Never
Check Type:Passive
Check Latency:0.655 seconds
Execution Time:0 seconds
State Change:0%

My snmptt.log shows this for my device 192.168.83.11 during a restart:

Fri Nov 7 12:50:25 2014 .1.3.6.1.6.3.1.1.5.1 Normal "Status Events" 192.168.83.11 - Device reinitialized (coldStart)
Fri Nov 7 12:50:26 2014 .1.3.6.1.6.3.1.1.5.1 Normal "Status Events" 192.168.83.11 - Device reinitialized (coldStart)
Fri Nov 7 12:54:00 2014 .1.3.6.1.6.3.1.1.5.5 Normal "Status Events" 192.168.83.11 - SNMP athentication failure

I have also added my community string to the check_xi_service_snmp command and applied configuration. I tested this and I get a response back from my device, but my device status information still shows "Waiting for Trap..." in the GUI.

David
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: No file called /usr/local/nagios/etc/objects/switch.cfg

Post by sreinhardt »

Let's get all the basics out of the way right off the bat. This looks like one of a couple easy issues to resolve.

Looking for bins:

Code: Select all

    ls -lva /usr/local/bin | grep -i 'snmp\|addmib'
    ls -lva /usr/local/sbin | grep -i 'snmp\|addmib'
    ls -lva /usr/sbin | grep -i 'snmp\|addmib'
    cat /etc/snmp/snmptrapd.conf | tail -n 50
snmptt\trapd settings and user perms:

Code: Select all

    grep -i 'daemon_uid\|mode =' /etc/snmp/snmptt.ini
    grep -i 'exec' /etc/snmp/snmptt.conf | tail -n 10
    grep -i 'nag' /etc/group
    grep -i 'snmp' /etc/group
Checking log and spool dirs:

Code: Select all

    ll /var/log/snmptt/
    ll -d /var/log/snmptt/
    ll /var/spool/snmptt
    ll -d /var/spool/snmptt
Most likely you are either missing the snmptraphandling.py file, exec lines in snmptt.conf, or the mibs that you added have not been translated into snmptt conf files. Once we get this information, we can see which it likely is.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked