bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Administration Guide

WebLogic SNMP Agent Command-Line Reference

WebLogic Server can use Simple Network Management Protocol (SNMP) to communicate with enterprise-wide management systems. The WebLogic Server subsystem that gathers WebLogic management data, converts it to SNMP communication modules (trap notifications), and forwards the trap notifications to third-party SNMP management systems is called the WebLogic SNMP agent. The WebLogic SNMP agent runs on the Administration Server and collects information from all Managed Servers within a domain.

The WebLogic SNMP agent provides a command-line interface that enables you to:

- Retrieve the value of WebLogic Server attributes that are exposed as managed objects in the WebLogic Server MIB.

- Generate and receive WebLogic Server traps.

The following sections describe working with the WebLogic SNMP agent through its command-line interface:

- Required Environment and Syntax for the SNMP Command-Line Interface

- Commands for Retrieving the Value of WebLogic Server Attributes

- Commands for Testing Traps

For more information about using SNMP with WebLogic Server, refer to the WebLogic SNMP Management Guide.

Required Environment and Syntax for the SNMP Command-Line Interface

Before you use the WebLogic SNMP agent's command-line interface, set up your environment and note command syntax information as described in the following sections.

Environment

To set up your environment for the WebLogic SNMP agent's command-line interface:

1. Install and configure the WebLogic Server software, as described in the WebLogic Server Installation Guide.

2. Enable the WebLogic SNMP agent, as described in "Setting Up the WebLogic SNMP Agent" in the Administration Console Online Help.

   Note: The snmpv1trap and snmptrapd commands do not require the SNMP agent to be enabled.

3. Open a command prompt (shell) and invoke the following script

   WL_HOME\server\bin\setWLSEnv.sh (or setWLSEnv.cmd on Windows)

   where WL_HOME is the directory in which you installed WebLogic Server.

   The script adds a supported JDK to the shell's PATH environment variable and adds WebLogic Server classes to the CLASSPATH variable.

Common Arguments

All WebLogic SNMP agent commands take the following form:

java command-name arguments

Table D-1 describes arguments that are common to most WebLogic SNMP agent commands.

Table D-1 Common Command Line Arguments

Argument | Definition
--- | ---
-d | Includes debugging information and packet dumps in the command output.
-c snmpCommunity [@server_name | @domain_name ] | Specifies the community name that the WebLogic SNMP agent uses to secure SNMP data and specifies the server instance that hosts the objects with which you want to interact. To request the value of an object on the Administration Server, specify: snmpCommunity where snmpCommunity is the SNMP community name that you set in the Community Prefix field when you configured the SNMP agent (as described in "Setting Up the WebLogic SNMP Agent" in the Administration Console Online Help). To request the value of an object on a Managed Server, specify: snmpCommunity@server_name where server_name is the name of the Managed Server. To request the value of an object for all server instances in a domain, send a community string with the following form: snmpCommunity@domain_name If you do not specify a value, the command assumes -c public, which attempts to retrieve the value of an object that is on the Administration Server.
-p snmpPort | Specifies the port number on which the WebLogic SNMP agent listens for requests. If you do not specify a value, the command assumes -p 161.
-t timeout | Specifies the number of milliseconds the command waits to successfully connect to the SNMP agent. If you do not specify a value, the command assumes -t 5000.
-r retries | Specifies the number of times the command retries unsuccessful attempts to connect to the SNMP agent. If you do not specify a value, the command exits on the first unsuccessful attempt.
host | Specifies the DNS name or IP address of the computer that hosts the WebLogic Server Administration Server, which is where the WebLogic SNMP agent runs.

Commands for Retrieving the Value of WebLogic Server Attributes

Table D-2 is an overview of commands that retrieve the value of WebLogic Server MBean attributes that are exposed in the WebLogic Server MIB.

Table D-2 Overview of Commands for Retrieving the Value of WebLogic Server Attributes

Command | Description
--- | ---
snmpwalk | Returns a recursive list of all managed objects that are below a specified node in the MIB tree. See snmpwalk.
snmpgetnext | Returns a description of the managed object that immediately follows an OID that you specify. See snmpgetnext.
snmpget | Returns a description of managed objects that correspond to one or more object-instance OIDs. See snmpget.

snmpwalk

Returns a recursive list of all managed objects that are below a specified node in the MIB tree.

If you specify the OID for an object type, the command returns a list of all instances of that type along with all instances of any child object types.

For example, if you specify the OID for an object type that corresponds to an MBean, this command returns a description of all instances of the MBean and all instances of the attributes within the MBeans.

To see the WebLogic Server MIB tree, refer to the WebLogic Server SNMP MIB Reference. For more information about the structure of the MIB and its object identifiers (OIDs), refer to "SNMP MIB for WebLogic" in WebLogic SNMP Management Guide.

Syntax

>     java snmpwalk [-d] [-c snmpCommunity] [-p snmpPort]
>                  [-t timeout] [-r retries] host OID

Argument | Definition
--- | ---
OID | Specifies the object ID of the node from which you want to retrieve a recursive list of object values. Start the value with '.'; otherwise, references are assumed to be relative to the standard MIB ( .1.3.6.1.2.1), not the WebLogic Server MIB.

For information about the command arguments that are not listed in the above table, refer to Table D-1.

Example

The following example returns all attributes of the ServerRuntimeMBean instance that is hosted on the Administration Server. Note that the OID .1.3.6.1.4.1.140.625.360 refers to the serverRuntimeTable object type in the WebLogic MIB.

java snmpwalk localhost .1.3.6.1.4.1.140.625.360

If you invoke this command from a computer that is running the Examples Server, the command returns output similar to the following truncated output. Note that the output includes the full OID for each attribute instance below the serverRuntimeTable object.

>     Object ID:
>     .1.3.6.1.4.1.140.625.360.1.1.32.101.98.52.50.55.97.53.101.55.101.
>     56.97.51.98.97.52.99.97.57.53.100.51.51.98.102.51.98.57.48.98.51.
>     55
>     STRING: eb427a5e7e8a3ba4ca95d33bf3b90b37

>     Object ID:
>     .1.3.6.1.4.1.140.625.360.1.5.32.101.98.52.50.55.97.53.101.55.101.
>     56.97.51.98.97.52.99.97.57.53.100.51.51.98.102.51.98.57.48.98.51.
>     55
>     STRING: ServerRuntime:examplesServer

>     Object ID:
>     .1.3.6.1.4.1.140.625.360.1.10.32.101.98.52.50.55.97.53.101.55.101
>     .56.97.51.98.97.52.99.97.57.53.100.51.51.98.102.51.98.57.48.98.51
>     .55
>     STRING: ServerRuntime

>     Object ID:
>     .1.3.6.1.4.1.140.625.360.1.15.32.101.98.52.50.55.97.53.101.55.101
>     .56.97.51.98.97.52.99.97.57.53.100.51.51.98.102.51.98.57.48.98.51
>     .55
>     STRING: examplesServer
>     ...

The following example retrieves the name of all servers in the examples domain. The OID specified in the example command is the numerical value that the WebLogic Server MIB assigns to the serverRuntimeName object type.

java snmpwalk -c public@examples localhost
.1.3.6.1.4.1.140.625.360.1.15

The following example returns all attributes of the ServerRuntimeMBean instance that is hosted on a Managed Server named MS1. Note that the OID .1.3.6.1.4.1.140.625.360 refers to the serverRuntimeTable object in the WebLogic MIB.

java snmpwalk -c public@MS1 localhost .1.3.6.1.4.1.140.625.360

snmpgetnext

Returns a description of the managed object that immediately follows one or more OIDs that you specify.

Instead of the recursive listing that the snmpwalk command provides, this command returns the description of only the one managed object whose OID is the next in sequence. You could string together a series of snmpgetnext commands to achieve the same result as the snmpwalk command.

If you specify an object type, this command returns the first instance of the object type, regardless of how many instances of the type exist.

To see the WebLogic Server MIB tree, refer to the WebLogic Server SNMP MIB Reference. For information about the structure of the MIB and its object identifiers (OIDs), refer to "SNMP MIB for WebLogic" in WebLogic SNMP Management Guide.

Syntax

>     java snmpgetnext [-d] [-c snmpCommunity] [-p snmpPort]
>                  [-t timeout] [-r retries] host OID [OID]...

Argument | Definition
--- | ---
OID [OID]... | Specifies one or more object IDs. You can specify an OID for an object type or an object instance. Start the values with '.'; otherwise, references are assumed to be relative to the standard MIB ( .1.3.6.1.2.1), not the WebLogic Server MIB.

For information about the command arguments that are not listed in the above table, refer to Table D-1.

Example

The following example retrieves the name of an application that has been deployed on the Administration Server. The OID in the example command is for the applicationRuntimeName object type, which represents the Name attribute of the applicationRuntime MBean.

java snmpgetnext localhost .1.3.6.1.4.1.140.625.105.1.15

The command returns output similar to the following:

>     Response PDU received from /127.0.0.1, community: public
>     Object ID:
>     .1.3.6.1.4.1.140.625.105.1.15.32.49.102.98.97.100.97.102.99.57.48
>     .50.102.48.98.53.54.100.100.49.54.50.54.99.54.99.49.97.97.98.53.
>     100.97
>     STRING: MyServer_uddiexplorer

To determine whether there are additional applications deployed on the Administration Server, you can use the output of the initial snmpgetnext command as input for an additional snmpgetnext command:

java snmpgetnext localhost .1.3.6.1.4.1.140.625.105.1.15.32.49.102.98.97.100.97.102.99.57.48
.50.102.48.98.53.54.100.100.49.54.50.54.99.54.99.49.97.97.98.53.
100.97

The command returns output similar to the following:

>     Response PDU received from /127.0.0.1, community: public
>     Object ID:
>     .1.3.6.1.4.1.140.625.105.1.15.32.54.98.49.101.57.56.54.98.98.50.
>     57.100.54.55.48.100.56.98.101.101.97.55.48.53.57.99.49.51.56.98.
>     97.99
>     STRING: MyServer_StartupEAR

The following example specifies two OIDs to retrieve the name of an application that has been deployed on the Administration Server and the name of a JDBC connection pool. The OIDs in the example command are for the applicationRuntimeName object type, which represents the Name attribute of the ApplicationRuntime MBean, and jdbcConnectionPoolRuntimeName, which represents the Name attribute of the JDBCConnectionPoolRuntimeMBean.

java snmpgetnext localhost .1.3.6.1.4.1.140.625.105.1.15
.1.3.6.1.4.1.140.625.190.1.15

The command returns output similar to the following:

>     Response PDU received from /127.0.0.1, community: public
>     Object ID:
>     .1.3.6.1.4.1.140.625.105.1.15.32.49.102.98.97.100.97.102.99.57.48
>     .50.102.48.98.53.54.100.100.49.54.50.54.99.54.99.49.97.97.98.53.
>     100.97
>     STRING: MyServer_uddiexplorer
>     Object ID:
>     .1.3.6.1.4.1.140.625.190.1.15.32.53.53.49.48.50.55.52.57.57.49.99
>     .102.55.48.98.53.50.54.100.48.100.53.53.52.56.49.57.49.49.99.99.
>     99
>     STRING: MyPool

snmpget

Retrieves the value of one or more object instances. This command does not accept OIDs for object types.

Syntax

>     java snmpget [-d] [-c snmpCommunity] [-p snmpPort]
>                  [-t timeout] [-r retries] host object-instance-OID
>                  [object-instance-OID]...

Argument | Definition
--- | ---
object-instance-OID [object-instance-OID]... | The object ID of an object instance. This command does not accept OIDs for object types. Start the value with '.'; otherwise, references are assumed to be relative to the standard MIB, not the WebLogic Server MIB.

Example

The following example retrieves the value of the serverRuntimeState and serverRuntimeListenPort attribute instances for the Administration Server.

>     java snmpget localhost
>     .1.3.6.1.4.1.140.625.360.1.60.32.102.100.48.98.101.102.100.99.102
>     .52.98.97.48.48.49.102.57.53.51.50.100.102.53.55.97.101.52.56.99
>     .99.97.99
>     .1.3.6.1.4.1.140.625.360.1.35.32.102.100.48.98.101.102.100.99.102
>     .52.98.97.48.48.49.102.57.53.51.50.100.102.53.55.97.101.52.56.99.
>     99.97.99

The command returns output similar to the following:

>     Response PDU received from /127.0.0.1, community: public
>     Object ID:
>     .1.3.6.1.4.1.140.625.360.1.60.32.102.100.48.98.101.102.100.99.102
>     .52.98.97.48.48.49.102.57.53.51.50.100.102.53.55.97.101.52.56.99.
>     99.97.99
>     STRING: RUNNING
>     Object ID:
>     .1.3.6.1.4.1.140.625.360.1.35.32.102.100.48.98.101.102.100.99.102
>     .52.98.97.48.48.49.102.57.53.51.50.100.102.53.55.97.101.52.56.99.
>     99.97.99
>     INTEGER: 7001

Commands for Testing Traps

Table D-3 is an overview of commands that generate and receive traps for testing purposes.

Table D-3 Overview of Commands for Retrieving Information about WebLogic Server

Command | Description
--- | ---
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. See snmpv1trap.
snmptrapd | Starts a daemon that receives traps and prints information about the trap. See snmptrapd.

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

snmptrapd

Starts a daemon that receives traps and prints information about the trap.

Syntax

>     java snmpv1trap [-d] [-c snmpCommunity] [-p TrapDestinationPort]

Argument | Definition
--- | ---
-c snmpCommunity | Specifies that community name that the SNMP agent (or snmpv1trap command) used to generate the trap. If you do not specify a value, the command assumes -c public.
-p TrapDestinationPort | Specifies the port number on which the trap daemon receives traps. If you do not specify a value, the command assumes -p 162.

Example

The following command starts a trap daemon and instructs it to listen for requests on port 165. The daemon runs in the shell until you kill the process or exit the shell:

java snmptrapd -p 165

If the command succeeds, the trap daemon returns a blank line with a cursor. The trap daemon waits in this state until it receives a trap, at which point it prints the trap.

Example: Sending Traps to the Trap Daemon

To generate WebLogic Server traps and receive them through the trap daemon:

1. Open a command prompt (shell) and invoke the following script:

   WL_HOME\server\bin\setWLSEnv.sh (or setWLSEnv.cmd on Windows)
   where WL_HOME is the directory in which you installed WebLogic Server.

2. To start the trap daemon, enter the following command:

   java snmptrapd

3. Open another shell and invoke the following script:

   WL_HOME\server\bin\setWLSEnv.sh (or setWLSEnv.cmd on Windows)

4. To generate a trap, enter the following command:

   java snmpv1trap localhost .1.3.6.1.4.140.625 localhost 6 60 1000

The snmpv1trap command generates a serverStart Trap and broadcasts it through port 162.

In the shell in which the trap daemon is running, the daemon prints 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: