Hi Russ.
Russ Woodman wrote:
Hi,
I am attempting to receive traps from various devices on my network (Copper Mountain DSLAMs, Cisco routers, etc.) so that I can then funnel the traps into Nagios for network monitoring. However, nothing I have tried for the last three or more months has allowed me to receive/handle any traps sent by any devices. Below are some relevant files and configuration.
It looks like your script is not processing the output of snmptrapd correctly. Snmptrapd will output multiple lines to the handler. If you try the following snmptrapd.conf and traphandle.sh, it should work. The script is a slightly modified version of the snmptrap tutorial at:
http://www.net-snmp.org/tutorial-5/commands/snmptrap.html
snmptrapd.conf: traphandle default /usr/local/bin/traphandle.sh
traphandle.sh: #!/bin/bash LOGFILE="/tmp/snmptrapd.log" read host read ip vars= while read oid val do if [ "$vars" = "" ] then vars="$oid = $val" else vars="$vars, $oid = $val" fi done echo trap: $1 $host $ip $vars >> ${LOGFILE} exit 0
If you want to integrate snmptrapd with Nagios, I suggest you take a look at snmptt. There is documentation on integrating with Nagios and Netsaint:
http://www.snmptt.org http://www.snmptt.org/docs/snmptt.shtml#Nagios-Netsaint
Alex
10782 ? S 0:00 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid
10784 ? Ss 0:00 /usr/sbin/snmptrapd -Lsd -p /var/run/snmptrapd.pid
snmptrapd.conf: traphandle default /usr/local/bin/traphandle.sh default
traphandle.sh: #!/bin/bash
LOGFILE="/tmp/snmptrapd.log"
case ${1} in default) echo -e "Found default trap:" >> ${LOGFILE} echo -e "${*}\n" >> ${LOGFILE} ;; *) echo -e "Found unhandled trap:" >> ${LOGFILE} echo -e "${*}\n" >> ${LOGFILE} ;; esac
exit 0
snmp.conf mibs ALL
I have the Copper Mountain MIB located in /usr/share/snmp/mibs, where all of the other default MIBs are located. When run in debug mode, the snmptrapd output shows the Copper Mountain MIB is processed. When I bring up and drop an interfaces on a Copper Mountain DSLAM, tcpdump on the receiving host running snmptrapd shows:
09:36:35.926828 IP 172.20.7.2.1966 > ldhl-sentry.natcotech.com.snmp-trap: C=Natco Trap(36) E:1996 172.20.7.2 enterpriseSpecific s=12 132246500 .iso.org=[|snmp]
09:37:14.772609 IP 172.20.7.2.1967 > ldhl-sentry.natcotech.com.snmp-trap: C=Natco Trap(36) E:1996 172.20.7.2 enterpriseSpecific s=12 132246890 .iso.org=[|snmp]
So I know the trap packet is being received. But the file /tmp/snmptrapd.log referenced in the traphandle.sh script never has anything in it.
Can someone please help me figure out why I have never been able to receive or process SNMP traps using net-snmp--before I go stark raving mad? If someone is able to work with me via phone or IM in an interactive way, that would be greatly appreciated.
Regards, Russ
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
Net-snmp-users mailing list
[EMAIL PROTECTED]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users