You can monitor for unsolicited SNMP trap messages by using the SNMP trap support. These trap messages may contain helpful data for managing a network.
By using the i5/OS SNMP manager, it is possible to deliver SNMP traps to data queues. All traps that are received on an iSeries server can be routed to user-defined data queues as shown in Figure: SNMP Trap Support. Your applications should monitor the data queue to receive trap information.
SNMP trap support uses the exit point QIBM_QZCA_SNMPTRAP and a data queue that you define. To use SNMP trap support, do the following:
CALL PGM(QUSRGPT) PARM('QIBM_QZCA_SNMPTRAP ' 'ZCAT0100' X'00000000' X'00000000')
Note: The first parameter must be 20 characters long.
CRTDTAQ DTAQ(QGPL/MYQUEUE) MAXLEN(32780)
This configuration only registers the data queue name. You may want to add the program name and library that will use this data queue even though this information is not used by the system.
Figure: Work with Registration Information (WRKREGINF) Display
+--------------------------------------------------------------------------------+ | Work with Registration Information | | | | Type options, press Enter. | | 5=Display exit point 8=Work with exit programs | | | | Exit | | Exit Point | | Opt Point Format Registered Text | | QIBM_QTA_TAPE_TMS TMS00200 *YES | | QIBM_QTF_TRANSFER TRAN0100 *YES Original File Transfer Functi | | QIBM_QVP_PRINTERS PRNT0100 *YES Original Virtual Print Server | | QIBM_QZCA_ADDC ZCAA0100 *YES Add Client exit point | | QIBM_QZCA_REFC ZCAF0100 *YES Refresh Client Information ex | | QIBM_QZCA_RMVC ZCAR0100 *YES Remove Client exit point | | 8 QIBM_QZCA_SNMPTRAP ZCAT0100 *YES | | QIBM_QZCA_UPDC ZCAU0100 *YES Update Client Information exi | | QIBM_QZDA_INIT ZDAI0100 *YES Database Server - entry | | QIBM_QZDA_NDB1 ZDAD0100 *YES Database Server - database a | | QIBM_QZDA_NDB1 ZDAD0200 *YES Database Server - database a | | More... | | Command | | ===> | | F3=Exit F4=Prompt F9=Retrieve F12=Cancel | +--------------------------------------------------------------------------------+
Figure: Work with Exit Programs Display is reached using Option 8 from the display shown in the Figure above.
Figure: Work with Exit Programs
Display
+--------------------------------------------------------------------------------+ | Work with Exit Programs | | | | Exit point: QIBM_QZCA_SNMPTRAP Format: ZCAT0100 | | | | Type options, press Enter. | | 1=Add 4=Remove 5=Display 10=Replace | | | | Exit | | Program Exit | | Opt Number Program Library | | 1 TRAPCHECK QGPL | | | | (No exit programs found.) | | | | | | | | | | | | | | | | Command | | ===> | | F3=Exit F4=Prompt F5=Refresh F9=Retrieve F12=Cancel | +--------------------------------------------------------------------------------+
Figure: Add Exit Programis reached using Option 1 from the Figure above and pressing F10 for additional parameters.
Figure: Add Exit Program - Display 1 of
2
+--------------------------------------------------------------------------------+ | Add Exit Program (ADDEXITPGM) | | | | Type choices, press Enter. | | | | Exit point . . . . . . . . . . . > QIBM_QZCA_SNMPTRAP | | Exit point format . . . . . . . > ZCAT0100 Name | | Program number . . . . . . . . . > 1 1-2147483647, *LOW, *HIGH | | Program . . . . . . . . . . . . > TRAPCHECK Name | | Library . . . . . . . . . . . > QGPL Name, *CURLIB | | Text 'description' . . . . . . . Reroute traps | | | | | | Additional Parameters | | | | Replace existing entry . . . . . > *NO *YES, *NO | | Create exit point . . . . . . . *NO *YES, *NO | | | | | | | | | | More... | | F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display | | F24=More keys | +--------------------------------------------------------------------------------+
Figure: Add Exit Program - Display 2 of 2
+--------------------------------------------------------------------------------+ | Add Exit Program (ADDEXITPGM) | | | | Type choices, press Enter. | | | | Exit program data: | | Coded character set ID . . . . *NONE Number, *NONE, *JOB | | Length of data . . . . . . . . *CALC 0-2048, *CALC | | Program data . . . . . . . . . QGPL/MYQUEUE | | | | | | | | | | | | | | | | | | | | | | | | | | Bottom | | F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display | | F24=More keys | +--------------------------------------------------------------------------------+
Notes:
Offset | Type | Field | |
---|---|---|---|
Dec | Hex | ||
0 | 0 | CHAR(10) | Entry type (always *SNMPTRAP) |
10 | A | CHAR(2) | Entry ID (currently 01) |
12 | C | BINARY(4) | Version (This is the start of the trap header. All displacements are from the start of the trap header.) |
16 | 10 | BINARY(4) | Length of community name |
20 | 14 | BINARY(4) | Displacement to community name |
24 | 18 | BINARY(4) | Length of enterprise object ID |
28 | 1C | BINARY(4) | Displacement to enterprise object ID |
32 | 20 | BINARY(4) | Length of agent address |
36 | 24 | BINARY(4) | Displacement to agent address |
40 | 28 | BINARY(4) | Generic trap type |
44 | 2C | BINARY(4) | Specific trap code |
48 | 30 | BINARY(4) | Time stamp |
52 | 34 | BINARY(4) | Number of variable bindings |
56 | 38 | BINARY(4) | Displacement to first variable binding |
Note: An array of variable bindings follows. | |||
These fields repeat for each variable binding | BINARY(4) | Length of object name | |
BINARY(4) | Displacement to object name | ||
BINARY(4) | Length of value | ||
BINARY(4) | Displacement to value | ||
BINARY(4) | Value type (Values for this field can be found in i5/OS library QSYSINC, file H, member QTOMEAPI.) | ||
Note: All object names and values follow. | |||
CHAR(*) | Object names and values for all variable bindings |
Top | UNIX-Type APIs | APIs by category |