com.hp.ucmdb.discovery.library.clients.query
Class SNMPClient

java.lang.Object
  extended by com.hp.ucmdb.discovery.library.clients.BaseClient
      extended by com.hp.ucmdb.discovery.library.clients.query.QueryClient
          extended by com.hp.ucmdb.discovery.library.clients.query.SNMPClient

public class SNMPClient
extends QueryClient

The SNMPClient class supports command execution using the SNMP protocol.
Here is example of using an SNMPClient for disks discovery:


     client = Framework.getClientFactory(ClientsConsts.SNMP_PROTOCOL_NAME).createClient()
     data_name_mib = '1.3.6.1.2.1.25.2.3.1.3,1.3.6.1.2.1.25.2.3.1.4,string,1.3.6.1.2.1.25.2.3.1.5,double,1.3.6.1.2.1.25.2.3.1.6,string,1.3.6.1.2.1.25.2.3.1.7,string,1.3.6.1.2.1.25.2.3.1.2,string,1.3.6.1.2.1.25.2.3.1.4,string'
     resultSet = client.executeQuery(data_name_mib)

     # Now looping over result and fetching data
     while resultSet.next():
                        diskName = resultSet.getString(2)
                        diskSize = resultSet.getString(3)
                        diskType = resultSet.getString(6)

 
How to build the SNMP query statement:
The query statement contains a comma-separated list of elements. First, define the first column of the table. Because the first column size determines the size of the rest of the columns, this is the only column for which the start index and index are set. The end index and start index are both MIB (Management Information Base) numbers. After setting the indexes, set the column type.
Example of definition of the first column:
 1.3.6.1.2.1.25.2.3.1.3,1.3.6.1.2.1.25.2.3.1.4,string 
The example has start index 1.3.6.1.2.1.25.2.3.1.3 and end index 1.3.6.1.2.1.25.2.3.1.4. Therefore, the table for this column has all values between these MIB numbers. The type of all values in this column is 'string'

For the rest of the columns, only the start index is defined, because the number of retrieves from the MIB database is the same as the number of values retrieved for the first column. For example, If we get X values between the first column start and end index, each of the rest of the columns will retrieve exactly X values starting from the its start index. If a column contains fewer elements than the first column, the result for this column is padded with Nulls. * After setting the indexes, set the column type.
Example of definition of the columns after the first:
 1.3.6.1.2.1.25.2.3.1.5,double 
In this example, all values returned for this column in the table are of type 'double'

See Also:
QueryClient, ClientsConsts

Field Summary
static java.lang.String _port
           
static java.lang.String _postfix
           
static java.lang.String _retry
           
 
Fields inherited from class com.hp.ucmdb.discovery.library.clients.BaseClient
CREDENTIALS_ID, ENCODING
 
Constructor Summary
SNMPClient(ClientsFrameworkImpl framework, java.util.Properties props)
           
 
Method Summary
 int getPort()
          Returns the SNMP port to which the client is connected.
 int getRetries()
          Returns the number of retries before the connect fails.
 boolean supportMultiOid()
          Checks if MultiOid is supported.
 
Methods inherited from class com.hp.ucmdb.discovery.library.clients.query.QueryClient
executeQuery
 
Methods inherited from class com.hp.ucmdb.discovery.library.clients.BaseClient
close, getClientType, getCredentialId, getIpAddress, getProperty, getShellCmdSeperator, getSudoCommands, getSudoPaths, getTimeout, getUserName, isConnected, supportsSudo
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_port

public static final java.lang.String _port
See Also:
Constant Field Values

_retry

public static final java.lang.String _retry
See Also:
Constant Field Values

_postfix

public static final java.lang.String _postfix
Constructor Detail

SNMPClient

public SNMPClient(ClientsFrameworkImpl framework,
                  java.util.Properties props)
           throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getPort

public int getPort()
Returns the SNMP port to which the client is connected. The port number is specified in the protocol definition.

Returns:
port number

getRetries

public int getRetries()
Returns the number of retries before the connect fails. The retry limit is specified in the protocol definition.

Returns:
The retry limit

supportMultiOid

public boolean supportMultiOid()
                        throws java.lang.Exception
Checks if MultiOid is supported.

Returns:
true if supported
Throws:
java.lang.Exception


Documentation Feedback
Copyright 2010 Hewlett-Packard Development Company, L.P.