# Appendix G

| # SNMP Trap Subscription

> This appendix covers the following topics:

- Sun Management Center Agent Components and Trap Subscription--page 639
- Subscribing for Traps--page 640
- Sun Management Center Enterprise Specific Traps--page 645
- SNMP Trap Subscription Support--page 647

## Sun Management Center Agent Components and Trap Subscription

> Sun Management Center agent components (including the Trap Handler) support SNMP trap subscription. Trap subscription allows interested parties to request that selected SNMP traps be forwarded to them. Sun Management Center agent components can also subscribe for traps.

> Every Sun Management Center agent component supports a MIB that contains the `.iso*base.trapForward` branch, which contains the following nodes:

- `clientRegistrar`--supports trap subscription for specific traps through the specification of the trap criteria.
- `jobAdder`--for existing trap subscriptions with the tag criteria set to be true. This node supports incremental additions to the list hosts of interest.
- `jobRemover`--for existing trap subscriptions with the tag criteria set to be true, this node supports incremental deletions from the list of hosts of interest.

> The `jobAdder` and `jobRemover` nodes are designed to be used with the Sun Management Center agent SNMP job caches, which are used to support periodic SNMP jobs.

## Subscribing for Traps

> The cl`ientRegistrar` node is used to subscribe for traps and is located at:

> `iso.org.dod.internet.private.enterprises...base.trapForward.\
> clientRegistrar`

> For the SUN enterprise MIB, the corresponding url for this node is:

>     snmp://<host>:<port>/sym//iso/org/dod/internet/private/
>     enterprises/sun/prod/sunsymon/agent/base/trapForward/
>     clientRegistrar#0

> To subscribe for SNMP traps from a Sun Management Center agent component, perform an SNMP set of a trap subscription specification into the `clientRegistrar` node. If a trap client has an existing trap subscription, a subsequent subscription replaces the previous subscription. The trap subscription specification has the following format:

>     {<ipAddress>:<snmpPort> {{{<spec1} {<spec2>} ...}}}

> where:

|  | ipAddress is the IP Address of the trap subscriber.

|  | snmpPort is the SNMP port of the trap subscriber.

|  | specN is the trap filter criteria, filter criteria expressions, or subscription expiry specification.

> Trap filter criteria are specified using the following format:

>     {<criteria> <regexp>}

> where:

|  | criteria is the trap filter criteria. These criteria are mapped to the contents of the trap PDU.

|  | regexp is the regular expression for the corresponding criteria

> Possible criteria values are:

- `trapAddress`--IP address of trap originator
- `trapOID`--Trap object identifier
- `oid` N - Nth OID in trap varbind
- `value` N - Nth value in the trap varbind
- `tag` - flag indicating whether to use the taglist criteria which contains a list of host IP addresses when determining a match (that is, if true, use taglist; if false, ignore taglist)
- `taglist` - list of host IP address to match against the IP address of trap originator. The entries cannot be regular expressions, they must be actual IP address.

> The tag and taglist criteria is designed to be used by agent SNMP job cache, which subscribes for traps from a specific a list of IP addresses hosts. This explicit list of IP addresses is used in place of a regular expression to support the dynamic modification of the list via the `jobAdder` and `jobRemover` nodes.

> By default, if multiple trap filter criteria are specified, they are OR'd together. To modify this behaviour, filter criteria expressions can be used.

> Filter criteria expressions are specified as follows:

>     {filter-exp {%<criteria1> <logical operator> %<criteria2> ...}}

> where:

|  | `criteria` N is one of the filter criteria specified above

|  | `logical operator` can be a logical AND '&&' or logical OR '||'

> Subscription expiry is specified as follows:

>     {expiry <seconds>}

> where:

|  | `seconds` is the number of seconds before subscription is cancelled. For a subscription that does not expire, 0 can be specified. If the expiry is not specified, it defaults to ~46 days.

### Trap Subscription Examples

> For example, if your process is on host:port 204.225.247.123:162 and you wish to subscribe for `linkDown` (whose trap OID is 1.3.6.1.6.3.1.1.5.3) traps from any agent, set the following trap subscription specification:

>     {204.225.247.123:162 {{{trapOID 1.3.6.1.6.3.1.1.5.3}}}}

> Similarly, to subscribe for all linkDown (1.3.6.1.6.3.1.1.5.3) and linkUp (1.3.6.1.6.3.1.1.5.4) traps, set the following trap subscription specification:

>     {204.225.247.123:162 {{{trapOID
>     ^1\\.3\\.6\\.1\\.6\\.3\\.1\\.1\\.5\\.[34]}}}}

> > Note - The regular expression includes double backslashes '\\' for the dots '.' since one set is removed when the expression is processed by the Tcl procedure that processes the trap subscription request.

> To subscribe for all linkDown traps originating from a specific agent on host:port 204.225.247.100:161, set the following trap subscription specification:

>     {204.225.247.123:162 {{{trapAddress 204.225.247.100} {trapOID
>     1.3.6.1.6.3.1.1.5.3} {filter-exp {trapAddress && trapOID}}}}}

> For example, if your process is on host 129.146.53.216 port 2000, and you wish to subscribe for statusChange (whose OID is 1.3.6.1.4.1.42.2.12.2.0.1) traps from any agent, set the following trap subscription specification:

>     {129.146.53.216:2000 {{{trapOID 1.3.6.1.4.1.42.2.12.2.0.1}}}}

> Similarly, to subscribe for statusChange, valueRefresh, moduleLoaded, moduleUnloaded (respective OIDs are 1.3.6.1.4.1.42.2.12.2.0.1 1.3.6.1.4.1.42.2.12.2.0.2 1.3.6.1.4.1.42.2.12.2.0.4 1.3.6.1.4.1.42.2.12.2.0.5 ) traps from any agent, set the following trap subscription specification:

>     {129.146.53.216:2000 {{{trapOID 1.3.6.1.4.1.42.2.12.2.0.[1245]}}}}

> Similarly, to subscribe for statusChange, valueRefresh traps from an agent running on 129.146.53.216, set the following subscription specification:

>     {129.146.53.216:2000 {{{trapAddress 129.146.53.216 } {trapOID
>     1.3.6.1.4.1.42.2.12.2.0.[12]}
>     {filter-exp {trapAddress && trapOID}}}}}

### SNMP SET Command

> The following are the SNMP set commands for above examples:

> Trap subscription in Sun Management Center Trap Handler (running on 129.146.53.216:162) for statusChange trap:

>     snmpset -h 129.146.53.216 -p 162 -c community \
>     1.3.6.1.4.1.42.2.12.2.1.4.1.0  "OctetString" \
>     "{129.146.53.216:2000 \
>     {{{trapOID 1.3.6.1.4.1.42.2.12.2.0.1}}}}"

> Trap subscription in Sun Management Center Trap Handler (running on 129.146.53.216:162) for statusChange, valueRefresh, moduleLoaded, moduleUnloaded traps.

>     snmpset -h 129.146.53.216 -p 162 -c community \
>     1.3.6.1.4.1.42.2.12.2.1.4.1.0 OctetString "{129.146.53.216:2000 \
>     {{{trapOID 1.3.6.1.4.1.42.2.12.2.0.[1245]}}}}"

> Trap subscription in Sun Management Center Trap Handler (running on 129.146.53.216:162) for statusChange and valueRefresh traps from agent running on 129.146.53.216.

>     snmpset -h 129.146.53.216 -p 162 -c community \
>     1.3.6.1.4.1.42.2.12.2.1.4.1.0  "OctetString" \
>     "{129.146.53.216:2000 \
>     {{{trapAddress 129.146.53.216 } {trapOID \
>     1.3.6.1.4.1.42.2.12.2.0.[12]} \
>     {filter-exp {trapAddress && trapOID}}}}}"

> > Note - All of the preceding `snmpset` commands will work if the Trap Handler is configured for no authentication. Otherwise, these sets have to be valid `SNMPV2USEC SET` Commands.

### Adding Jobs

> The `jobAdder` node is used to incrementally add IP addresses to the `taglist` criteria of an existing trap subscription. This node is located at:

>     iso.org.dod.internet.private.enterprises...base.trapForward.jobAdder

> For the SUN enterprise MIB, the corresponding url for this node is:

>     snmp://<host>:<port>/sym//iso/org/dod/internet/private/enterprises/
>     sun/prod/sunsymon/agent/base/trapForward/jobAdder#0

> To add jobs to an existing subscription for traps from a Sun Management Center agent component, perform an SNMP set of a trap subscription specification into this node. The job adder specification has the following format:

>     <subscriber address> <list of IP addresses>

> where:

|  | `subscriber address` is the IP address:port of the subscriber

|  | `list of IP address` is one or more IP addresses to be added to the taglist.

### Removing Jobs

> The`jobRemover` node is used to remove IP address entries from the taglist criteria of an existing trap subscription. This node is located at:

>     iso.org.dod.internet.private.enterprises...base.trapForward.jobRemover

> For the SUN enterprise MIB, the corresponding URL for this node is:

>     snmp://<host>:<port>/sym//iso/org/dod/internet/private/enterprises/
>     sun/prod/sunsymon/agent/base/trapForward/jobRemover#0

> To remove jobs from an existing subscription for SNMP traps from a Sun Management Center agent component, perform an SNMP set of a trap subscription specification into this node. The job remover specification has the following format:

>     <subscriber address> <list of IP addresses>

> where:

|  | `subscriber address` is the IP address:port of the subscriber

|  | `list of IP address` is one or more IP addresses to be removed from the taglist.

## Sun Management Center Enterprise Specific Traps

> This section provides the MIB for enterprise specific traps generated by Sun Management Center agent.

> CODE EXAMPLE G-1 Sun Management Center Enterprise Specific Traps

>     sun       OBJECT IDENTIFIER ::= { enterprises 42 }
>     prod      OBJECT IDENTIFIER ::= { sun 2 }
>     sunsymon  OBJECT IDENTIFIER ::= { prod 12 }
>     agent     OBJECT IDENTIFIER ::= { sunsymon 2 }
>     base OBJECT IDENTIFIER ::= { agent 1 }
>     traps OBJECT IDENTIFIER ::= { base 0 }
>     trapInfo OBJECT IDENTIFIER ::= { base 3 }

>     statusChange NOTIFICATION-TYPE
>     OBJECTS { statusOID }
>     STATUS current
>     DESCRIPTION
>     "A statusChange trap signifies that the status of an object has
>     changed."
>     ::= { traps 1 }
>     valueRefresh NOTIFICATION-TYPE
>     OBJECTS { refreshOID }
>     STATUS current
>     DESCRIPTION
>     "A valueRefresh trap signifies that the value of an object has been
>     manually refreshed."
>     ::= { traps 2 }

>     event NOTIFICATION-TYPE
>     OBJECTS { eventInfo }
>     STATUS current
>     DESCRIPTION
>     "An event trap signifies that an event has been detected and logged
>     by the monitoring software."
>     ::= { traps 3 }

>     moduleLoaded NOTIFICATION-TYPE
>     OBJECTS { version }
>     STATUS current
>     DESCRIPTION
>     "A moduleLoaded trap signifies that a module has been loaded."
>     ::= { traps 4 }

>     moduleUnloaded NOTIFICATION-TYPE
>     OBJECTS { version }
>     STATUS current
>     DESCRIPTION
>     "A moduleUnloaded trap signifies that a module has been unloaded."
>     ::= { traps 5 }

>     statusOID OBJECT-TYPE
>     SYNTAX OBJECT IDENTIFIER
>     MAX-ACCESS accessible-for-notify
>     STATUS current
>     DESCRIPTION
>     "The identification of the object for which the status changed.
>     This occurs as the first trap-specific varbind in a
>     statusChangeTrap."
>     ::= { trapInfo 1 }

>     refreshOID OBJECT-TYPE
>     SYNTAX OBJECT IDENTIFIER
>     MAX-ACCESS accessible-for-notify
>     STATUS current
>     DESCRIPTION
>     "The identification of the object for which the value was refreshed
>     changed. This occurs as the first
>     trap-specific varbind in a valueRefreshTrap."
>     ::= { trapInfo 2 }

>     eventInfo OBJECT-TYPE
>     SYNTAX OCTET STRING
>     MAX-ACCESS accessible-for-notify
>     STATUS current
>     DESCRIPTION
>     "The event message of the object for which an event was detected.
>     This occurs as the first trap-specific
>     varbind in an eventTrap."
>     ::= { trapInfo 3 }

## SNMP Trap Subscription Support

> Sun Management Center agent components (including the Trap Handler) support SNMP trap subscription. Trap subscription allows interested parties to request selected SNMP traps be forwarded to them. Sun Management Center agent components can also subscribe for traps.

> Every Sun Management Center agent component supports a MIB that contains the clientRegistrar node. The clientRegistrar node is located at:

>     iso.org.dod.internet.private.enterprises...base.trapForward.clientRegistra

> For the SUN enterprise MIB, the corresponding url for this node is:

>     snmp://<host>:<port>/sym//iso/org/dod/internet/private/enterprises\

>     /sun/prod/sunsymon/agent/base/trapForward/clientRegistrar#0

> To subscribe for SNMP traps from a Sun Management Center agent component, one performs an SNMP set of a trap subscription specification into the clientRegistrar node. The trap subscription specification has the following format:

>     {<ipAddress>:<snmpPort> {{{<spec1} {<spec2>} ...}}}

> where:

> ipAddress is the IP Address of the trap subscriber

> snmpPort is the SNMP port of the trap subscriber

> specN is the trap filter criteria, filter criteria expressions, or subscription expiry specification

> Trap filter criteria are specified using the following format:

>     {<criteria> <regexp>}

> where:

> criteria is the trap filter criteria. These criteria are mapped to the contents of the trap PDU.

> regexp is the regular expression for the corresponding criteria

> Possible criteria values are:

> trapAddress - IP address of trap originator

> trapOID - trap object identifier

> oidN - Nth OID in trap varbind

> valueN - Nth value in the trap varbind

> By default, if multiple trap filter criteria are specified, they are OR'd together. To modify this behavior, filter criteria expressions can be used.

> Filter criteria expressions are specified as follows:

>     {filter-exp {%<criteria1> <logical operator> %<criteria2> ...}}

> where:

> criteriaN is one of the filter criteria specified above

> logical operator can be a logical AND '&&' or logical OR '||'

> Subscription expiry is specified as follows:

>     {expiry <seconds>}

> where:

> seconds is the number of seconds before subscription is cancelled. For a subscription that does not expire, 0 can be specified. If the expiry is not specified, it defaults to ~46 days.

> For example, if your process is on host:port 204.225.247.123:162 and you wish to subscribe for linkDown (whose trap OID is 1.3.6.1.6.3.1.1.5.3) traps from any agent, set the following trap subscription spec:

>     {204.225.247.123:162 {{{trapOID 1.3.6.1.6.3.1.1.5.3}}}}

> Similarly, to subscribe for all linkDown (1.3.6.1.6.3.1.1.5.3) and linkUp (1.3.6.1.6.3.1.1.5.4) traps, set the following trap subscription spec:

>     {204.225.247.123:162 {{{trapOID ^1\\.3\\.6\\.1\\.6\\.3\\.1\\.1\\.5\\.[34]}}}}

> > Note - The regular expression includes double backslashes '\\' for the dots '.' since one set is removed when the expression is processed by the Tcl procedure that processes the trap subscription request.

> To subscribe for all linkDown traps originating from a specific agent on host:port 204.225.247.100:161, set the following trap subscription spec:

>     {204.225.247.123:162 {{{trapAddress 204.225.247.100} {trapOID\
>     1.3.6.1.6.3.1.1.5.3} {filter-exp {trapAddress && trapOID}}}}}

Copyright © 2000 Sun Microsystems, Inc. All Rights Reserved.