[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5

snmpevent Command

Purpose

Sends ERRM events to an SNMP manager.

Syntax

snmpevent [-a host-name] [-c community] [-h]

Description

The snmpevent script sends a Simple Network Management Protocol (SNMP) trap of an event response resource manager (ERRM) event to a host running an SNMP agent. The agent formats the trap information into an SNMP trap and sends it to the SNMP manager defined in its configuration file. This script is meant to be called by the predefined ERRM response Generate SNMP trap. Event or rearm event information is captured and posted by ERRM in environment variables that are generated when an ERRM event or a rearm event occurs.

The snmpevent script can also be used as a template to create other user-defined actions. See the RSCT Guide and Reference to understand how an event response resource runs an action command.

The following message template is sent as a trap when an event or a rearm event occurs and snmpevent is the defined response:

 [ERRM_COND_SEVERITY] [ERRM_TYPE] occurred:
           Condition: [ ERRM_COND_NAME]
           Node:  [ERRM_NODE_NAME]
           Resource: [ERRM_RSRC_NAME]
           Resource Class:  [ERRM_RSRC_CLASS_NAME]
           Resource Attribute: [ERRM_ATTR_NAME]
           Attribute Type: [ERRM_DATA_TYPE]
           Attribute Value: [ERRM_VALUE]

The environment variables have the following definitions:

ERRM_COND_SEVERITY
Specifies the significance of the condition resource that caused the event or rearm event. The valid values are: Critical, Warning, or Informational.
ERRM_TYPE
Specifies the type of event that occurred. The valid values are: event or rearm event.
ERRM_COND_NAME
Specifies the name of the condition resource with the attribute value that changed to cause this event or rearm event.
ERRM_NODE_NAME
Specifies the host name on which this event or rearm event occurred.
ERRM_RSRC_NAME
Specifies the name of the resource with the attribute that changed to cause this event or rearm event.
ERRM_RSRC_CLASS_NAME
Specifies the name of the resource class to which the resource that caused this event or rearm event belongs.
ERRM_ATTR_NAME
Specifies the name of the resource attribute that changed to cause this event or rearm event.
ERRM_DATA_TYPE
Specifies the data type of the resource attribute.
ERRM_VALUE
Specifies the value of the resource attribute that changed to cause this event or rearm event.

The snmpevent command captures these environment variable values and formats a generic message that is sent as a trap via a call to the snmptrap command.

Flags

-a
Defines the host name of the SNMP agent to which the AIX subagent will connect.
-c
Specifies the SNMP community to be used. This can be any string the SNMP agent will accept. The default is public.
-h
Writes this script's usage statement to standard output.

Parameters

log_file
Specifies the name of the file where event information is logged. An absolute path for the log_file parameter should be specified.

The log_file is treated as a circular log and has a fixed size of 64KB. When log_file is full, new entries are written over the oldest existing entries.

If log_file already exists, event information is appended to it. If log_file does not exist, it is created so that event information can be written to it.

Exit Status

0
The script has run successfully.
1
An error occurred when the script was run.

Restrictions

This script must be run on the node where the ERRM is running.

Standard Output

When the -h flag is specified, this script's usage statement is written to standard output.

Examples

  1. Suppose the command /usr/sbin/rsct/bin/snmpevent is an action in the critical-notification response, which is associated with the CSM predefined condition NodeChanged. This can be done with the mkcondresp command followed by the startcondresp command. The /etc/snmpdv3.conf file should be configured to where the trap will be sent. In this example, if you want the trap sent to 9.117.16.246, write the /etc/snmpdv3.conf file as follows:
    VACM_GROUP group1 SNMPv1  public  -
    
    VACM_VIEW defaultView        internet                   - included 
    -VACM_ACCESS  group1 - - noAuthNoPriv SNMPv1  defaultView - defaultView -
    
    NOTIFY notify1 traptag trap -
    
    #TARGET_ADDRESS Target1 UDP 127.0.0.1       traptag trapparms1 - - -
    TARGET_ADDRESS Target1 UDP 9.117.16.246       traptag trapparms1 - - -
    
    TARGET_PARAMETERS trapparms1 SNMPv1  SNMPv1  public  noAuthNoPriv -
    
    COMMUNITY public    public     noAuthNoPriv 0.0.0.0     0.0.0.0         -
    
    DEFAULT_SECURITY no-access - -
    
    logging         file=/usr/tmp/snmpdv3.log       enabled
    logging         size=0                          level=0
    
    smux            1.3.6.1.4.1.2.3.1.2.1.2         gated_password  # gated
    
    snmpd smuxtimeout=200 #muxatmd
    smux 1.3.6.1.4.1.2.3.1.2.3.1.1 muxatmd_password #muxatmd 
    Then, restart the snmpd daemon by first killing the snmpd daemon that is currently running and then starting it again:
    # ps -ef | grep snmpd
        root  4570 12956   1 08:24:32  pts/0  0:00 grep snmpd
        root 13810     1   0 08:11:04      -  0:00 snmpd
    # kill -9 13810
    # snmpd
    Next, change the LParID property of node c175n08 to 12:
    # chnode c175n08 LParID=12
    Now, on the machine 9.117.16.158 (the machine with the SNMP manager that was specified in the /etc/snmpdv3.conf file), the SNMP manager should record something like this:
    2002-07-15 09:09:25 c174tr1.ppd.pok.ibm.com [9.114.78.17] TRAP, SNMP v1, 
    community public
            enterprises.ibm Enterprise Specific Trap (1) Uptime: 0:01:45.00
            enterprises.ibm.ibmProd.191.1.6.1.0 = "Informational Event 
    occurred. Condition=NodeChanged Node=c174tr1.ppd.pok.ibm.com 
    Resource=c175n08.ppd.pok.ibm.com Resource Class=Node Resource 
    Attribute=Changed Attributes Attribute Type=CT_CHAR_PTR_ARRAY Attribute 
    Val={LParID} "

    The output varies based on SNMP managers.

Location

/usr/sbin/rsct/bin/snmpevent
Contains the snmpevent script

Related Information

Commands: snmptrap

Books: see the RSCT Guide and Reference for information about the event response resource manager (ERRM) and about how to use ERRM environment variables

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]