Skip Headers
Oracle® Fusion Middleware Command Reference for Oracle WebLogic Server
12c Release 1 (12.1.1)

Part Number E24487-02
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
PDF · Mobi · ePub

4 WebLogic SNMP Agent Command-Line Reference (Deprecated)

This chapter describes how to work with the WebLogic SNMP agent.

Note:

The command-line utility that this document describes is deprecated in WebLogic Server 10.0. Instead, use the command-line utility that is described in "WebLogic SNMP Command-Line Utility" in SNMP Management Guide for Oracle WebLogic Server.

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 (managed objects), 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 managed objects from all Managed Servers within a domain.

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

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

For more information about using SNMP with WebLogic Server, see:

Required Environment for the SNMP Command-Line Interface

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

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

  2. If you want to retrieve WebLogic Server managed objects, enable the WebLogic SNMP agent as described in "Use SNMP to monitor WebLogic Server" in the Oracle WebLogic Server Administration Console Help.

  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.

Syntax and Common Arguments for the SNMP Command-Line Interface

All WebLogic SNMP agent commands take the following form:

java command-name arguments 

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

Table 4-1 Common Command Line Arguments

Argument Definition
-d 

Includes debugging information and packet dumps in the command output.

-v {v1 | v2} 

Specifies whether to use SNMPv1 or SNMPv2 to communicate with the SNMP agent.

You must specify the same SNMP version that you set in the Trap Version field when you configured the SNMP agent (as described in "Create SNMP agents" in the Oracle WebLogic Server Administration Console Help).

If you do not specify a value, the command assumes -v v1.

-c snmpCommunity 
[@server_name | @domain_name 

The community name that you set for the WebLogic SNMP agent and optionally specifies the server instance that hosts the objects with which you want to interact.

To request a managed 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 "Create SNMP agents" in the Oracle WebLogic Server Administration Console Help).

To request a managed object on a single Managed Server, specify:

snmpCommunity@server_name 

where server_name is the name of the Managed Server.

To request a managed object for all server instances in a domain, specify a community string with the following form:

snmpCommunity@domain_name 

where domain_name is the name of the WebLogic Server domain.

If you do not specify a value for this argument, the command assumes -c public, which uses the default community name, and assumes that the specified managed object is on the Administration Server.

-p snmpPort 

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 

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 

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 

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 WebLogic Server Managed Objects

Table 4-2 is an overview of commands that retrieve WebLogic Server managed objects and object instances.

Table 4-2 Overview of Commands for Retrieving Data from WebLogic Server Managed Objects

Command Description
snmpwalk 

Returns all managed objects and instances that are below a specified node in the MIB.

See snmpwalk.

snmpgetnext 

Returns the managed object or instance that immediately follows an OID that you specify.

See snmpgetnext.

snmpget 

Returns managed object instances that correspond to one or more OIDs.

See snmpget.


snmpwalk

Returns all managed objects or instances that are below a specified node in the MIB.

If you specify the OID for a tabular object, the command returns all of its object instances along with all related (child) objects and instances.

Syntax

java snmpwalk [-d] [-v (v1,v2)] [-c snmpCommunity] [-p snmpPort] 
              [-t timeout] [-r retries] host OID 

Table 4-3 describes the OID argument that is passed to snmpwalk.

Table 4-3 snmpwalk Arguments

Argument Definition
OID 

The object ID of the node from which you want to retrieve a set of child objects and instances.

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.


Example

The following example retrieves the names of all applications that have been deployed on the Administration Server. The managed object for an application name is applicationRuntimeName, which is a child of the applicationRuntimeTable object. (See http://download.oracle.com/docs/cd/E24329_01/apirefs.1211/e24404/BEA-WEBLOGIC-MIB.asn1.zip.)

java snmpwalk localhost .1.3.6.1.4.1.140.625.105.1.15 

If you invoke this command from a computer that is running the example MedRecServer, the command returns output similar to the following truncated output. Note that the output includes the full OID for each instance of the applicationRuntimeName object.

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: MedRecServer_uddiexplorer

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.10
0.54.55.48.100.56.98.101.101.97.55.48.53.57.99.49.51.56.98.97.99
STRING: MedRecServer_StartupEAR

Object ID: .1.3.6.1.4.1.140.625.105.1.15.32.56.48.97.53.50.52.99.101.53.54.57.54
.52.52.99.54.48.55.54.100.102.49.54.97.98.52.48.53.98.100.100.49
STRING: MedRecServer_wl_management_internal2
...

The following example retrieves the name of all applications that have been deployed on all servers in the medrec domain.

java snmpwalk -c public@medrec localhost .1.3.6.1.4.1.140.625.105.1.15 

The following example retrieves the name of all applications that have been deployed on a Managed Server named MS1.

java snmpwalk -c public@MS1 localhost .1.3.6.1.4.1.140.625.105.1.15 

snmpgetnext

Returns a description of the managed object or object instance that immediately follows one or more OIDs that you specify. If you specify a tabular object, this command returns the first child managed object. If you specify a scalar object, this command returns the first instance of the object.

Instead of the recursive listing that the snmpwalk command provides, this command returns the description of only one managed object or instance 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.

Syntax

java snmpgetnext [-d] [-v (v1,v2)] [-c snmpCommunity] [-p snmpPort] 
             [-t timeout] [-r retries] host OID [OID]...

Table 4-4 describes the OID arguments that can be passed to the snmpgetnext command.

Table 4-4 snmpgetnext Arguments

Argument Definition
OID [OID]...

One or more object IDs. Use a space to delimit multiple OIDs. You can specify OIDs for objects or instances.

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.


Example

The following example retrieves the name of an application that has been deployed on the Administration Server. The managed object for an application name is applicationRuntimeName, which is a scalar object and is a child of the applicationRuntimeTable object. (See http://download.oracle.com/docs/cd/E24329_01/apirefs.1211/e24404/BEA-WEBLOGIC-MIB.asn1.zip.)

java snmpgetnext localhost .1.3.6.1.4.1.140.625.105.1.15 

If you invoke this command from a computer that is running the example MedRecServer, 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: MedRecServer_uddiexplorer

To determine whether there are additional applications deployed on the Administration Server, you can use the output of the 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.10
0.54.55.48.100.56.98.101.101.97.55.48.53.57.99.49.51.56.98.97.99
STRING: MedRecServer_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, which is the name of an application, and jdbcConnectionPoolRuntimeName, which is the name of a JDBC connection pool.

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 

If you invoke this command from a computer that is running the example MedRecServer, 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: MedRecServer_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: MedRecPool-PointBase

snmpget

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

Syntax

java snmpget [-d] [-v (v1,v2)] [-c snmpCommunity] [-p snmpPort] 
             [-t timeout] [-r retries] host object-instance-OID 
             [object-instance-OID]... 

Table 4-5 describes the object-instance-OID arguments that can be passed to the snmpget command.

Table 4-5 snmpget Arguments

Argument Definition
object-instance-OID [object-instance-OID]... 

The object ID of an object instance. This command does not accept OIDs for managed objects.

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 serverRuntimeState and serverRuntimeListenPort managed object instances for the Administration Server. Both of these objects are children of the serverRuntimeTable object. (See http://download.oracle.com/docs/cd/E24329_01/apirefs.1211/e24404/BEA-WEBLOGIC-MIB.asn1.zip.)

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

If you invoke this command from a computer that is running the example MedRecServer, 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 4-6 is an overview of commands that generate and receive traps for testing purposes.

Table 4-6 Overview of Commands for Retrieving Information about WebLogic Server

Command Description
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.

See snmpv1trap.


snmptrapd

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

Syntax

java snmptrapd [-d] [-c snmpCommunity] [-p TrapDestinationPort]

Table 4-7 describes the arguments that are passed to the snmptrapd command.

Table 4-7 snmptrapd Arguments

Argument Definition
-c snmpCommunity 

The 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 

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.

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.

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 "OIDs for WebLogic Server Notifications" in the SNMP Management Guide for Oracle WebLogic Server.

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] ...

Table 4-8 describes the arguments that are passed to the snmpv1trap command.

Table 4-8 snmpv1trap Arguments

Argument Definition
-c snmpCommunity 

A community name for the trap. SNMP managers (or the trap daemon) can access the trap only if they are configured to use this community name.

If you do not specify a value, the command assumes -c public.

-p TrapDestinationPort 

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 

The DNS name or IP address of the computer that hosts the SNMP manager or trap daemon.

.1.3.6.1.4.140.625

The value of the trap's enterprise field, which contains the beginning portion of the OID for all WebLogic Server traps.

agent-addr 

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 

The value of the trap's generic trap type field.

For a list of valid values, refer to "OIDs for WebLogic Server Notifications" in the SNMP Management Guide for Oracle WebLogic Server.

specific-trap 

The value of the trap's specific trap type field.

For a list of valid values, refer to "OIDs for WebLogic Server Notifications" in the SNMP Management Guide for Oracle WebLogic Server.

timestamp 

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) 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. For example:

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 

In the preceding 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.

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 

Example: Using snmpv1trap to Send Traps to the Trap Daemon

To use the snmpv1trap command 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: 

Example: Using the WebLogic SNMP Agent to Send Traps to the Trap Daemon

To use WebLogic SNMP agent to generate WebLogic Server traps and receive them through the trap daemon:

  1. Start the Administration Server for a domain and enable the SNMP agent.

    See "Create SNMP agents" in the Oracle WebLogic Server Administration Console Help.

  2. Create a trap destination to represent the trap daemon. Configure the trap destination to use port 165. Keep all other default settings that the Administration Console presents.

    See "Create trap destinations" in the Oracle WebLogic Server Administration Console Help.

  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.

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

    java snmptrapd -p 165
    
  5. Restart the Administration Server.

When the Administration Server starts, the SNMP agent generates a serverStart trap and broadcasts it through port 165.

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: 65
Time: 1000
VARBINDS: