On Tue, Aug 08, 2017 at 08:42:39PM +0000, Michael Stein wrote:
> This is my first time working with SNMP, but after reading the SNMP pages I'm 
> still having trouble getting a simple shell script to run when receiving a 
> trap.
> 
> My /etc/snmp/snmptrapd.conf file looks like this:
> 
> # Example configuration file for snmptrapd
> #
> # No traps are handled by default, you must edit this file!
> #
> disableAuthorization yes
> authCommunity log,execute,net public
> # the generic traps
> traphandle default /usr/local/bin/snmptrapd.sh
> 
> The snmptrapd.sh script just says "hello".
> 
> #!/bin/sh
> 
> echo "hello"
> 
> The script is executable and runs when executed independently:
> 
> > /usr/local/bin/snmptrapd.sh
> Hello

This obviously isn't the output from a run of your script, but I would still
suggest that you modify it to read

---
#! /bin/sh

echo "hello" >> /tmp/my-log-file
---

With that change it seems to work for me.

/MF

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to