Using Command Line Tools

About

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 additional arguments optionally.

Commands

traped list modules

# traped list modules

Prints a list of all modules

traped list handlers

# traped list handlers

Prints a list of all handlers

traped list matches

# traped list matches

Prints a list of matches in a form: <trap_oid> <handler_name>

traped create module

# traped create module <name>

Creates an empty module <name>

Example:

# traped create module test

traped create handler

# traped create handler <name>

Creates an 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 via stdin

Example:

# traped update test < test.lua

traped detele

# traped delete <name>

Deletes handler/module <name>

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

Note1: * in a pattern means "a substring of any length consisting of any symbols"

Note2: you must enclose pattern in quotes

traped unbind

# traped unbind { <oid> | "<pattern>" | fallback } <name>

Unbinds handler <name>, essentially reverting the same bind command

traped move

# traped move up|down { <oid> | "<pattern>" | fallback } <name>
Move match between trap and handler higher in the list, so that it can be processed sooner example:
# traped list matches
.1.2.3* test1 .1.2.3.4.5 test2

In case a trap with oid .1.2.3.4.5 comes - 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

In case a trap with oid .1.2.3.4.5 comes - test2 will be processed first, then test1