|
The Trap Parser editor is a tool to create a Trap Parser file. Trap Viewer parses the file created using the Trap Parser editor, with the help of the TrapParserBean, to match each incoming traps with certain criterion. Trap Parsers are required to translate or parse traps into understandable information because traps typically contain cryptic information which is not easily understandable to the users.
The Trap Parser editor:
configures Trap Parser files.
parses the traps into an understandable format.
Invoking the Trap Parser
To invoke the Trap Parser editor, click the Parser Editor button in Trap Viewer UI. You can create a new Parser file from an existing Parser file or a MIB file. You also have an option to create a parser file from scratch using the Create Custom Parser File option. The image below depicts the first screen of the Trap Parser editor.

Load Trap Parsers and MIB Files
The next screen of the Trap Parser editor has the options for loading Trap Parser files. There is also an option for loading MIB files that contain trap definitions. The image below shows the loading and saving options of the Trap Parser editor.

Match Criteria
Each incoming trap has to essentially possess the Parser match criteria to be shown in the trap table. In the General tab of the next screen, you can enter any number of Parser match criteria into a single parser file with a different parser name. Trap Viewer looks for a match criterion sequentially. Once a criterion is matched for a trap, further checking of match criteria is skipped, and an event is fired to display the corresponding trap entry in the trap table.
While listening to traps, only one parser file can be loaded by Trap Viewer. A parser file can have any number of match criteria. Trap Viewer checks all the criteria in a Trap Parser file sequentially until one criterion matches. The image below depicts the General tab of the Trap Parser editor.

The various match criteria are tabulated below. These are mandatory parameters.
| Match Criteria | Description |
|---|---|
|
Generic Type |
Each trap has a generic type number. The Generic types are 0-coldStart, 1-warmStart, 2-linkDown, 3-linkUp, 4-authenticationFailure, 5-egpNeighborLoss, and 6-enterpriseSpecific. The number is to be specified for the Trap Parser. The trap is parsed only when the criteria matches. The only exception is that, a trap is parsed even when the generic field is left blank or a negative value is entered in the field. |
|
Specific Type |
This field can have an integer value from 0 to 2147483647. If this field is to be matched, the Generic Type must always be enterprise specific. |
|
Enterprise OID |
This is the SNMP enterprise identifier in the trap, which is used for unique identification of traps for a particular application. If you specify the OID in this field, the parser is applied only if the trap enterprise field begins with the enterprise field that you have specified. The only exception is that even when the enterprise field is left blank, the trap is allowed to be parsed. |
If you had loaded a MIB file or a parser file in the previous screen, the corresponding trap parsers are listed in the Parser List section. You can add, modify, or delete these parsers to create your parser file.
OID and Value
In the OID tab, you can specify the multiple values in the OID and Value text fields to match. The Trap PDU should match all the OID:Value pairs to conform to this criterion. This criterion extends the matching criterion. The following image depicts the OID tab of the Trap Parser editor.

Agent and Port
In the Agent tab, the trap is sent by an agent, specified in the Agent and Port text fields. If the value of Port is 0, the source can send the trap from any port. The incoming trap must match any of the criteria in the Agent and Port text fields. The following image shows the Agent tab of the Trap Parser editor.

OutPut Event Parameters
For each matching criterion, a trap name is given. The fields in the event details are configured in the Output Event section. Once the trap is matched by the criteria, the trap is added to the Trap Table. The Output Event parameters are shown as the Trap Details, which gives more specific information on the trap.
By default, some of the field of the Output Event parameters are filled by a variable called parser variables usually starting with a "$". These variables substitute specific characteristics of the parser in the Trap Details. The following image shows the various Output Event parameters.

Each parser variable and its corresponding characteristics are tabulated below.
| Variables | Characteristics |
|---|---|
|
$Community |
This token is replaced by the community string of the received trap. |
|
$Source |
This token is replaced by the source name/address of the received trap. |
|
$Enterprise |
This token is replaced by the enterprise ID of the received trap. |
|
$Agent |
This token is replaced by the agent address of the received trap. |
|
$SpecificType |
This token is replaced by the specific type of the received trap. |
|
$GenericType |
This token is replaced by the generic type of the received trap. |
|
$Uptime |
This token is replaced by the up time value in the received trap. |
|
$* |
This token is replaced by all the variable bindings of the received trap, including the OID and values of each variable binding. |
|
$# |
This token is replaced by all the SNMP variable values in the variable bindings of the received trap. |
|
$N |
This token is replaced by the (N-1)th SNMP variable value in the variable bindings of the received trap. |
|
@* |
This token is replaced by all the OID values in the variable bindings of the received trap. |
|
@N |
This token is replaced by the (N-1)th OID value in the variable bindings of the received trap. |
|