SNMP Trap Support

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


SNMP Trap Support



Configuring Trap Support

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:

  1. Use the Work with Registration Information (WRKREGINF) command to determine if the QIBM_QZCA_SNMPTRAP exit point exists on your system (see Figure: Work with Registration Information (WRKREGINF) Display). If the exit point does not exist, create and register the exit point by using this command:
      CALL PGM(QUSRGPT)
        PARM('QIBM_QZCA_SNMPTRAP  '
        'ZCAT0100' X'00000000' X'00000000')
    

    Note: The first parameter must be 20 characters long.

  2. Define a data queue of 32780 bytes. For example, to define a data queue that is called MYQUEUE in library QGPL, enter:
      CRTDTAQ DTAQ(QGPL/MYQUEUE) MAXLEN(32780)
    

  3. Register the exit program and exit program data with the QIBM_QZCA_SNMPTRAP exit point by using the Work with Registration Information (WRKREGINF) command. For example, see Figure: Work with Registration Information (WRKREGINF) Display through Figure: Add Exit Program - Display 2 of 2.

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:

  1. The program data field on the Add Exit Program (ADDEXITPGM) display contains the library name and the data queue name that will be used by the trap manager. This data must not exceed 21 bytes.

  2. The exit program and library do not have to exist when they are added to the exit point.

  3. The format for the ZCAT0100 trap data queue entry follows. For details about the SNMP trap, refer to the Internet standard for the trap message described in RFC 1155 and RFC 1157. The values for the object type field can be found in i5/OS library QSYSINC, file H, member QTOMEAPI.

    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


  4. The library name and data queue must be specified in uppercase on the exit point.

  5. Multiple exit programs are supported on the QIBM_QZCA_SNMPTRAP exit point. Each exit program must contain only one data queue.

  6. A maximum of 100 data queues can be defined.

  7. The data queue names are retrieved from the exit point only when the trap manager is started. To activate any changes to the data queues, you must end the trap manager with the End Trap Manager (ENDTRPMGR) command and restart the trap manager with the Start Trap Manager (STRTRPMGR) command.

  8. In the preceding scenario, all traps are added to the data queue. If the queue is locked, damaged, destroyed, or named incorrectly, the traps are lost. It is the responsibility of the user application to remove traps from the queue. No messages are sent if the queue is full or traps not removed.


Top | UNIX-Type APIs | APIs by category