5 WebLogic SNMP Command-Line Utility

WebLogic Server provides a command-line utility that offers many of the same features as an SNMP manager. You can use this utility to test and troubleshoot the configuration of your SNMP agents in a WebLogic Server domain.

The following sections describe working with the WebLogic Server SNMP command-line utility:

Required Environment for the SNMP Command-Line Utility

To set up your environment for the WebLogic Server SNMP command-line utility:

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

  2. Create an SNMP agent and trap destination in a WebLogic Server domain. See "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 Commands for the SNMP Command-Line Utility

Invoke the SNMP command-line utility as follows:

java weblogic.diagnostics.snmp.cmdline.Manager command [-?]

where command is one of the commands described in Table 5-1 and -? outputs usage information for the specified command.

Table 5-1 SNMP Commands

Command Description
SnmpBulkWalk
[startingOID] [endingOID]

Returns a collection of MIB object instances (MIB variables) by repeatedly invoking SnmpGetNext in a pattern that you specify.

Starting from the first OID that you specify on the command line, the command invokes the SnmpGetNext command as many times as needed to retrieve all MIB variables below the object.

The command increments the OID that you specified on the command line and repeats the pattern described in the previous paragraph.

Optionally specify the -Bm argument, which groups multiple SnmpGetNext invocations in each request that it sends to the SNMP agent. For example, -Bm 3 causes this command to issue 3 SnmpGetNext invocations in each request until it reaches the last OID in the sequence.

SnmpInform 

Constructs an INFORM notification and distributes it to an SNMP manager or trap monitor.

SnmpGet

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

You can specify an optional interval at which this command repeatedly retrieves the value of the specified variable.

SnmpGetAll <columnOID>
[<columnOID>...] 

Walks the table columns that you specify and groups the column values for each row in the output. All specified columns must be from the same table.

SnmpGetBulk 
[OIDs]

Returns a collection of MIB variables by repeatedly invoking SnmpGetNext in a pattern that you specify. Optionally include the -Bn and -Bm arguments and one or more OIDs to specify the pattern.

The -Bn (non-repeaters) argument specifies the number of OID arguments on the command line for which the command will not repeatedly perform SnmpGetNext operations. For these OIDs, the command performs an SnmpGetNext operation once and then moves on to the next OID argument on the command line. Consider using -Bn and non-repeater OIDs for scalar objects.

The -Bm (maximum repetitions) argument specifies how many times the command will perform SnmpGetNext operations for all other OIDs on the command line. Consider using -Bm and associated OIDs for tabular objects.

SnmpGetNext

Returns managed objects or MIB variables. 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 object variable.

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

SnmpTrap

Constructs a TRAP notification and distributes it to an SNMP manager or trap monitor.

SnmpTrapLogger

Starts a process that listens for notifications. Writes each notification that it receives to a log file.

SnmpTrapMonitor

Starts a process that listens for notifications. Prints each notification that it receives to standard out.

SnmpWalk

Returns all managed objects or variables that are below a specified node in the MIB or within a specified range.

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


Examples

The examples in this section assume that you have created an SNMP agent on the Administration Server and that you have not modified the default values for the agent. (For example, the agent listens on UDP port 161 and uses public as its community name.)

These examples use the following options for loading the MIB module, which enables you to refer to managed objects by their display names instead of OIDs:

  • -m — Specifies the WebLogic Server MIB module, BEA-WEBLOGIC-MIB

  • -M — Specifies either the directory to, or the resource classpath of, the compiled MIB. In these examples, the resource classpath is used.

To see the display names for all WebLogic Server managed objects, refer to BEA-WEBLOGIC-MIB.asn1.zip.

  • The following example prints usage information for the SnmpWalk command:

    java weblogic.diagnostics.snmp.cmdline.Manager SnmpWalk -?

  • The following example retrieves the names of all applications that have been deployed in a domain.

    java weblogic.diagnostics.snmp.cmdline.Manager SnmpWalk
    -m BEA-WEBLOGIC-MIB -M /weblogic/diagnostics/snmp/mib
    applicationRuntimeObjectName
    
  • The following command retrieves all variable bindings for all applications in the domain. To make the network communication more efficient, it groups 3 SnmpGetBulk commands in each request:

    java weblogic.diagnostics.snmp.cmdline.Manager SnmpBulkWalk -v2 -Bm 3
    -m BEA-WEBLOGIC-MIB -M /weblogic/diagnostics/snmp/mib
    applicationRuntimeTable 
    
  • The following command retrieves the name of the first application that is deployed in the domain. Then it retrieves the name and Bytes Pending Count for the first two JMS servers in the domain:

    java weblogic.diagnostics.snmp.cmdline.Manager SnmpGetBulk -v2 
    -Bn 1 -Bm 2 applicationRuntimeObjectName
    jmsServerRuntimeObjectName jmsServerRuntimeBytesPendingCount