Page 1 of 8
Help with SNMP traps?
Posted: Thu Mar 21, 2013 12:05 pm
by jbennett
I have been trying to get SNMPtraps working for some time now.
I finally have a secondary box that I can use to send test traps (original Nagios box) to my new Nagios box with.
I have verified that I have net-snmp-utils installed on both boxes. On the old Nagios box I verified the UCD-TRAP-TEST-MIB.txt file in the /usr/share/snmp/mibs.
When I tried to restart SNMPTT on that box, I see the following message:
Code: Select all
[root@nagiosxivm ~]# service snmptt restart
Stopping snmptt: [ OK ]
Starting snmptt: PID file: /var/run/snmptt.pid
Could not open configuration file: /usr/share/snmp/mibs/processed_mibs/.txt (No such file or directory) at /usr/local/sbin/snmptt line 2733.
[ OK ]
Line 2733 and surrounding of /usr/local/sbin/snmptt:
Code: Select all
unless (open SNMPTTCONF, $snmpttconffile)
{
warn "Could not open configuration file: $snmpttconffile ($!)";
if ($DEBUGGING >= 1)
{
print "\n\tCould not open configuration file: $snmpttconffile\n";
}
When I try and send a trap from the old nagios box to the new nagios box in order to test:
Code: Select all
[root@nagiosxivm ~]# snmptrap -v 1 -c roadway 10.250.2.55 UCD-TRAP-TEST-MIB::demotraps \ "" 6 17 "" SNMPv2-MIB::syslocation.0 s "Here"
I get the help page for snmptrap. I'm guessing that the syntax is wrong for the above?
Re: Help with SNMP traps?
Posted: Thu Mar 21, 2013 12:21 pm
by scottwilkerson
Did you install this with the RPM in this document?
http://library.nagios.com/library/produ ... -nagios-xi
Can you run
Also, is UCD-TRAP-TEST-MIB installed on the server you are sending the trap from?
Finally, I think you have an extra slash in there, the command should read
Code: Select all
snmptrap -v 1 -c roadway 10.250.2.55 UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" SNMPv2-MIB::syslocation.0 s "Here"
(the slash was there to signify that both lines in the doc should be run as one)
Re: Help with SNMP traps?
Posted: Thu Mar 21, 2013 12:31 pm
by jbennett
Yes.
Code: Select all
[root@nagiosxivm ~]# cat /etc/snmp/snmptt.ini|tail
#DEBUGGING_FILE_HANDLER =
DEBUGGING_FILE_HANDLER = /var/log/snmptt/snmptthandler.debug
[TrapFiles]
# A list of snmptt.conf files (this is NOT the snmptrapd.conf file). The COMPLETE path
# and filename. Ex: '/etc/snmp/snmptt.conf'
snmptt_conf_files = <<END
/usr/share/snmp/mibs/processed_mibs/.txt
/etc/snmp/snmptt.conf
END
I even ran the following:
Code: Select all
[root@nagiosxivm ~]# addmib /usr/share/snmp/mibs/UCD-TRAP-TEST-MIB.txt
Also, is UCD-TRAP-TEST-MIB installed on the server you are sending the trap from?
This is from the server I'm sending the trap FROM:
Code: Select all
[root@nagiosxivm ~]# ls -l /usr/share/snmp/mibs/UCD-TRAP-TEST-MIB.txt
-rw-r--r-- 1 root nagios 268 Mar 19 19:46 /usr/share/snmp/mibs/UCD-TRAP-TEST-MIB.txt
Finally, I think you have an extra slash in there, the command should read
Code: Select all
snmptrap -v 1 -c roadway 10.250.2.55 UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" SNMPv2-MIB::syslocation.0 s "Here"
(the slash was there to signify that both lines in the doc should be run as one)
Thanks. I tried it without the slash and I see the following:
Code: Select all
[root@nagiosxivm ~]# snmptrap -v 1 -c roadway 10.250.2.55 UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" SNMPv2-MIB::syslocation.0 s "Here"
No log handling enabled - turning on stderr logging
Cannot find module (UCD-TRAP-TEST-MIB): At line 0 in (none)
UCD-TRAP-TEST-MIB::demotraps: Unknown Object Identifier
Re: Help with SNMP traps?
Posted: Thu Mar 21, 2013 12:40 pm
by scottwilkerson
From the bottom of /etc/snmp/snmptt.ini remove this line
Code: Select all
/usr/share/snmp/mibs/processed_mibs/.txt
Lets restart both the snmp services
Code: Select all
service snmptt restart
service snmprapd restart
Then on the sending machine lets try
Code: Select all
snmptrap -v 1 -M /usr/share/snmp/mibs -c roadway 10.250.2.55 UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" SNMPv2-MIB::syslocation.0 s "Here"
Re: Help with SNMP traps?
Posted: Thu Mar 21, 2013 1:01 pm
by jbennett
I did everything you suggested, but I'm still getting the same message:
Code: Select all
[root@nagiosxivm ~]# snmptrap -v 1 -M /usr/share/snmp/mibs -c roadway 10.250.2.55 UCD-TRAP-TEST-MIB::demotraps \ "" 6 17 "" SNMPv2-MIB::syslocation.0 s "Here"
No log handling enabled - turning on stderr logging
Cannot find module (UCD-TRAP-TEST-MIB): At line 0 in (none)
UCD-TRAP-TEST-MIB::demotraps: Unknown Object Identifier
Re: Help with SNMP traps?
Posted: Thu Mar 21, 2013 6:45 pm
by scottwilkerson
Can you run
Code: Select all
cat /usr/share/snmp/mibs/UCD-TRAP-TEST-MIB.txt
Re: Help with SNMP traps?
Posted: Thu Mar 21, 2013 7:22 pm
by jbennett
Yes:
Code: Select all
[root@nagiosxivm ~]# cat /usr/share/snmp/mibs/UCD-TRAP-TEST-MIB.txt
D-TRAP-TEST-MIB DEFINITIONS ::= BEGIN
IMPORTS ucdExperimental FROM UCD-SNMP-MIB;
demotraps OBJECT IDENTIFIER ::= { ucdExperimental 990 }
demoTrap TRAP-TYPE
ENTERPRISE demotraps
VARIABLES { sysLocation }
DESCRIPTION "An example of an SMIv1 trap"
::= 17
END
Re: Help with SNMP traps?
Posted: Thu Mar 21, 2013 7:43 pm
by scottwilkerson
You are missing a couple chars in the file....
edit that file to make the first line read
Code: Select all
UCD-TRAP-TEST-MIB DEFINITIONS ::= BEGIN
Re: Help with SNMP traps?
Posted: Thu Mar 21, 2013 7:50 pm
by jbennett
Ah ha! I think we're getting somewhere!
Code: Select all
[root@nagiosxivm ~]# snmptrap -v 1 -M /usr/share/snmp/mibs -c roadway 10.250.2.55 UCD-TRAP-TEST-MIB::demotraps \ "" 6 17 "" SNMPv2-MIB::syslocation.0 s "Here"
No log handling enabled - turning on stderr logging
getaddrinfo: Temporary failure in name resolution
unknown host:
Re: Help with SNMP traps?
Posted: Thu Mar 21, 2013 7:54 pm
by scottwilkerson
we still have an extra \ in there, just run
Code: Select all
snmptrap -v 1 -M /usr/share/snmp/mibs -c roadway 10.250.2.55 UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" SNMPv2-MIB::syslocation.0 s "Here"
Actually you can now likely make it
Code: Select all
snmptrap -v 1 -c roadway 10.250.2.55 UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" SNMPv2-MIB::syslocation.0 s "Here"