Using command line tools
Overview
Handlers and bindings are managed by a tool called traped
(TRAPper EDitor), which is located in /opt/trapper/bin
. It takes a command as its first argument, then optional additional arguments.
traped list matches
# traped list matches
Prints a list of matches in format <trap_oid> <handler_name>
.
traped create module
# traped create module <name>
Creates empty module <name>
.
Example:
# traped create module test
traped create handler
# traped create handler <name>
Creates empty handler <name>
.
Example:
# traped create handler test
traped read
# traped read <name>
Prints handler/module <name>
to stdout
.
Example:
# traped read test > test.lua
traped update
# traped update <name>
Updates handler/module <name>
with a script passed through stdin
.
Example:
# traped update test < test.lua
traped bind
# traped bind { <oid> | "<pattern>" | fallback } <name>
Binds handler <name>
to trap <oid>
, or to all traps with OIDs that match <pattern>
, or to all traps that were not processed by any other handler.
Examples:
# traped bind .1.2.3.4.5 test
# traped bind ".1.2.3*" test
# traped bind fallback test
Notes:
*
in a pattern meansa substring of any length consisting of any symbols
.- You must enclose patterns in quotes.
traped unbind
# traped unbind { <oid> | "<pattern>" | fallback } <name>
Unbinds handler <name>
, essentially reverting to the same bind command.
traped move
# traped move up|down { <oid> | "<pattern>" | fallback } <name>
Moves match to trap and handler higher in the list, so that it can be processed sooner.
Examples:
# traped list matches
.1.2.3* test1 .1.2.3.4.5 test2
If a trap has OID .1.2.3.4.5
, test1
will be processed first, then test2
.
# traped move up .1.2.3.4.5 test
# traped list matches
.1.2.3.4.5 test2 .1.2.3* test1
If a trap has OID .1.2.3.4.5
, test2
will be processed first, then test1
.