Command Reference
WebLogic SNMP Agent Command-Line Reference (Deprecated)
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 WebLogic SNMP Management Guide.
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:
- Retrieve WebLogic Server managed objects.
- Generate and receive WebLogic Server traps for testing purposes.
The following sections describe working with the WebLogic SNMP agent through its command-line interface:
- Required Environment for the SNMP Command-Line Interface
- Syntax and Common Arguments for the SNMP Command-Line Interface
- Commands for Retrieving WebLogic Server Managed Objects
- Commands for Testing Traps
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:
- Install and configure the WebLogic Server software, as described in the Installation Guide.
- 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 Administration Console Online Help.
- 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} 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 Administration Console Online Help). If you do not specify a value, the command assumes -v v1. -c snmpCommunity
[@server_name | @domain_nameThe 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 Administration Console Online 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
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 WebLogic Server SNMP MIB Reference.)
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_uddiexplorerObject 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_StartupEARObject 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]...
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 WebLogic Server SNMP MIB Reference.)
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_uddiexplorerTo 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.97The 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_StartupEARThe 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]...
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 WebLogic Server SNMP MIB Reference.)
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.99If 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]
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 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] ...
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 WebLogic SNMP Management Guide. 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 WebLogic SNMP Management Guide. 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. 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 localhostThe 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:
- 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.- To start the trap daemon, enter the following command:
java snmptrapd
- Open another shell and invoke the following script:
WL_HOME\server\bin\setWLSEnv.sh (or setWLSEnv.cmd on Windows)
- 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:
- Start the Administration Server for a domain and enable the SNMP agent.
See Create SNMP agents in the Administration Console Online Help.
- 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 Administration Console Online Help.
- 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.- To start the trap daemon, enter the following command:
java snmptrapd -p 165
- 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: