Help with SNMP traps?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Help with SNMP traps?

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Help with SNMP traps?

Post by scottwilkerson »

Did you install this with the RPM in this document?
http://library.nagios.com/library/produ ... -nagios-xi

Can you run

Code: Select all

cat /etc/snmp/snmptt.ini|tail
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)
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Re: Help with SNMP traps?

Post by jbennett »

scottwilkerson wrote:Did you install this with the RPM in this document?
http://library.nagios.com/library/produ ... -nagios-xi
Yes.
Can you run

Code: Select all

cat /etc/snmp/snmptt.ini|tail

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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Help with SNMP traps?

Post 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"
Last edited by scottwilkerson on Thu Mar 21, 2013 7:57 pm, edited 1 time in total.
Reason: remove /
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Re: Help with SNMP traps?

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Help with SNMP traps?

Post by scottwilkerson »

Can you run

Code: Select all

cat /usr/share/snmp/mibs/UCD-TRAP-TEST-MIB.txt
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Re: Help with SNMP traps?

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Help with SNMP traps?

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Re: Help with SNMP traps?

Post 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:
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Help with SNMP traps?

Post 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"
Last edited by scottwilkerson on Thu Mar 21, 2013 7:56 pm, edited 1 time in total.
Reason: added shorter command
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked