Template:FAQ:Applications 18

From Net-SNMP Wiki
Revision as of 21:52, 20 October 2006 by Dts12 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If a traphandler script works fine when run manually from the command line, but generates an error when triggered by an incoming notification, then this is probably down to one of two likely causes.

Firstly, the interactive shell environment may not be precisely the same as that for programs executed by the snmptrapd daemon. In particular, it's quite possible that the PATH environmental variable may not include all the additional directories that are commonly set up for a personal login configuration. To avoid this problem (particularly for traphandler shell scripts), it's worth giving the full path to all programs used within the script.

Secondly, the snmptrapd daemon may not always recognise the appropriate interpreter to use for a particular trap handler. If this is the case, then you can specify this interpreter explicitly as part of the trap handle directive:

       traphandle default /usr/bin/perl /usr/local/bin/log_it

Note that in this case, it's almost certain that you'll also need to give the full path to the traphandle script (as shown)