public class SNMPClient extends QueryClient
SNMPClient
class supports command execution using the SNMP protocol.
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:1.3.6.1.2.1.25.2.3.1.3,1.3.6.1.2.1.25.2.3.1.4,stringThe 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'
1.3.6.1.2.1.25.2.3.1.5,doubleIn this example, all values returned for this column in the table are of type 'double'
QueryClient
,
ClientsConsts
BaseClient.FilteredMethodsHandler
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
_port |
static java.lang.String |
_postfix |
static java.lang.String |
_retry |
CREDENTIALS_ID, ENCODING
Constructor and Description |
---|
SNMPClient(ClientsFrameworkImpl framework,
java.util.Properties props) |
Modifier and Type | Method and Description |
---|---|
ResultSet |
executeQuery(java.lang.String query,
int timeout)
Submits a query and returns the result set.
|
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.
|
executeQuery
addDeniedPackage, close, getClientType, getCredentialId, getIpAddress, getProperty, getShellCmdSeperator, getSudoCommands, getSudoPaths, getTimeout, getUserName, isConnected, setAttributeEncrypted, supportsSudo
public static final java.lang.String _port
public static final java.lang.String _retry
public static final java.lang.String _postfix
public SNMPClient(ClientsFrameworkImpl framework, java.util.Properties props) throws java.lang.Exception
java.lang.Exception
public ResultSet executeQuery(java.lang.String query, int timeout) throws java.lang.Exception
query
- The query to executeResultSet
with database-oriented API @see ResultSetjava.lang.Exception
ResultSet
public int getPort()
public int getRetries()
public boolean supportMultiOid() throws java.lang.Exception
java.lang.Exception