RE: unable to catch traps with a script
"Derey Moshe" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <069EC2DBE5B1E141AA7C689E481A75EF0162EECE@HOTEXV01.he.hotmail.co.il> |
I have never used perl to read from the standard input....but does the code: "echo $* >> /tmp/snmp.log" read from the standard input and write to a file??? IF it doesn't, then you need first to read from the standard input the following values which sent from trap: HOSTNAME The name of the host that sent the notification, as determined by gethostbyaddr (3). IPADDRESS The IP address of the host that sent the notification. VARBINDS A list of variable bindings describing the contents of the notification, one per line. The first token on each line (up until a space) is the OID of the varind, and the remainder of the line is its value. The format of both of these are controlled by the outputOption directive (or similar configuration). The first OID should always be SNMPv2-MIB::sysUpTime.0, and the second should be SNMPv2-MIB::snmpTrapOID.0. The remaining lines will contain the payload varbind list. For SNMPv1 traps, the final OID will be SNMPv2-MIB::snmpTrapEnterprise.0. Moshe. -----äåãòä î÷åøéú----- îàú: [email protected] áùí Thomas Anders ðùìç: ä 3/16/2006 4:08 AM àì: [email protected] òåú÷ ìéãéòä: ðåùà: Re: unable to catch traps with a script Folkert van Heusden wrote: > In /etc/snmp/snmptrapd.conf I have this: > traphandle default /usr/local/sbin/my_script > > where my_script is: > #!/bin/sh > > echo $* >> /tmp/snmp.log > > Now if an event comes in, I only get empty lines(!) in my > /tmp/snmp.log-file. From http://www.net-snmp.org/docs/man/snmptrapd.conf.html: The program is fed details about the notification to its standard input ^^^^^^^^^^^^^^ +Thomas -- Thomas Anders (thomas.anders at blue-cable.de) ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ 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 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 _______________________________________________ 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