skip to main content
Workflow
   
Workflow
The backbone of trapper are the handlers. Handler - is a rule that describes how SNMP traps and notifications influence nagios services. Handlers are created using a special domain specific language (DSL) described in chapter #2 “Writing Handlers”. Each time the handler is run it may change the state of one service on one host.
Handler can be associated with several OID patterns. Each OID pattern represents the trap OID we want the handler to handle or several OIDs if wild-cards are used:
`*` - star wild-card matches with any number of any symbols, so that pattern `*` will match any incoming trap and `.1.2*` will match all the traps that start from `.1.2`
There is also a special OID pattern `fallback` to denote fallback handlers. If trap OID does not much any of the OID patterns it will be processed by fallback handlers.
OID patterns are stored in a ordered way. When the new trap arrives, its OID is compared with each OID pattern from first to last and for each match the associated handler is executed. If no match have happened all the fallback handlers are executed one by one. One OID can match several patterns so one trap can change the state of several services.
Lets assume we have the following OID pattern list:
* - Common
.1.1 - Temperature
.1.* - Switch trap
fallback - Counter
fallback - Test
Then
trap `.2.2` will be handler by `Common` handler only;
trap `.1.2` will be handled by `Common` handler, then by `Switch trap` handler;
trap `.1.1` will be handled by `Common` handler, then by `Temperature` handler and then by `Switch trap` handler;
Handlers `Counter` and `Test` will never be used as we have `Common` handler matching all traps.
If there is no match-any pattern and the list looks like
1.1 - Temperature
.1.* - Switch trap
fallback - Counter
fallback - Test
Then
traps `.1.1` and `.1.2` will be handled the same way
trap `2.2` will be handled by `Counter` handler and then by `Test` handler