Page 1 of 4
No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Thu Nov 06, 2014 11:28 am
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
Re: No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Thu Nov 06, 2014 11:34 am
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
Re: No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Thu Nov 06, 2014 12:49 pm
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
Re: No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Thu Nov 06, 2014 3:21 pm
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?
Re: No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Thu Nov 06, 2014 4:45 pm
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
Re: No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Thu Nov 06, 2014 5:17 pm
by abrist
Yes. Remove the mib from:
What are that directory's permissions?
Re: No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Fri Nov 07, 2014 10:36 am
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
Re: No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Fri Nov 07, 2014 12:05 pm
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.
Re: No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Fri Nov 07, 2014 1:00 pm
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
Re: No file called /usr/local/nagios/etc/objects/switch.cfg
Posted: Fri Nov 07, 2014 2:10 pm
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.