Skip navigation.
Downloads | Product Documentation | Support

WebLogic Server Command Reference

## snmpv1trap

Constructs an SNMPv1 trap and distributes it to the SNMP manager or trap daemon that is running on the specified host and listening on the specified port number. For more information about the trap daemon, refer to snmptrapd.

As part of invoking this command, you specify the value for fields within the trap packet that you want to send. The values that you specify must resolve to traps that are defined in the WebLogic Server MIB. For information about WebLogic Server traps and the fields that trap packets require, refer to "Format of WebLogic Trap Notifications" in the WebLogic SNMP Management Guide.

### Syntax

>     java snmpv1trap [-d] [-c snmpCommunity] [-p TrapDestinationPort]
>               TrapDestinationHost .1.3.6.1.4.140.625
>               agent-addr generic-trap specific-trap timestamp
>               [OID {INTEGER | STRING | GAUGE | TIMETICKS | OPAQUE |
>               IPADDRESS | COUNTER} value] ...

Argument | Definition
--- | ---
`-c` `snmpCommunity` | Specifies a password (community name) that secures the data in the trap. If you do not specify a value, the command assumes `-c public`.
`-p` `TrapDestinationPort` | Specifies the port number on which the SNMP manager or trap daemon is listening. If you do not specify a value, the command assumes `-p 162`.
`TrapDestinationHost` | Specifies the DNS name or IP address of the computer that hosts the SNMP manager or trap daemon.
`.1.3.6.1.4.140.625` | Specifies the value of the trap's `enterprise` field, which contains the beginning portion of the OID for all WebLogic Server traps.
`agent-addr` | Specifies the value of the trap's `agent address` field. This field is intended to indicate the computer on which the trap was generated. When using the `snmpv1trap` command to generate a trap, you can specify any valid DNS name or IP address.
`generic-trap` | Specifies the value of the trap's `generic trap type` field. For a list of valid values, refer to "Format of WebLogic Trap Notifications" in the WebLogic SNMP Management Guide.
`specific-trap` | Specifies the value of the trap's `specific trap type` field. For a list of valid values, refer to "Format of WebLogic Trap Notifications" in the WebLogic SNMP Management Guide.
`timestamp` | Specifies the value of the trap's `timestamp` field. This field is intended to indicate the length of time between the last re-initialization of the SNMP agent and the time at which the trap was issued. When using the `snmpv1trap` command to generate a trap, any number of seconds is sufficient.
OID {INTEGER | STRING | GAUGE | TIMETICKS | OPAQUE | IPADDRESS | COUNTER} `value` | (Optional) Specifies the value of the trap's `variable bindings` field, which consists of name/value pairs that further describe the trap notification. For each name/value pair, specify an OID, a value type, and a value. For example, a log message trap includes a `trapTime` binding to indicate the time at which the trap is generated. To include this variable binding in the test trap that you generate, specify the OID for the `trapTime` variable binding, the `STRING` keyword, and a string that represents the time: `.1.3.6.1.4.1.140.625.100.5 STRING "2:00 pm"`

### Example

The following example generates a log message trap that contains the `trapTime` and `trapServerName` variable bindings. It broadcasts the trap through port 165. In the example:

- `6` is the generic trap value that specifies "other WebLogic Server traps."
- `60` is the specific trap value that WebLogic Server uses to identify log message traps.
- .1.3.6.1.4.1.140.625.100.5 is the OID for the `trapTime` variable binding and .1.3.6.1.4.1.140.625.100.10 is the OID for the `trapServerName` variable binding.

>     java snmpv1trap -p 165 localhost .1.3.6.1.4.140.625 localhost 6 60 1000
>     .1.3.6.1.4.1.140.625.100.5 STRING "2:00 pm" .1.3.6.1.4.1.140.625.100.10
>     STRING localhost

The SNMP manager (or trap daemon) that is listening at port number `165` receives the trap. If the trap daemon is listening on `165`, it returns the following:

`Trap received from: /127.0.0.1, community: public
Enterprise: .1.3.6.1.4.140.625
Agent: /127.0.0.1
TRAP_TYPE: 6
SPECIFIC NUMBER: 60
Time: 1000
VARBINDS:
Object ID: .1.3.6.1.4.1.140.625.100.5
STRING: 2:00 pm
Object ID: .1.3.6.1.4.1.140.625.100.10
STRING: localhost`