SnmpService, TransactionManagerpublic class SNMP4JAgentSnmpService extends Object implements SnmpService
SnmpService interface for
SNMP4J-Agent agents. Instead of communication using UDP or TCP transport, this service directly provides
access to a MOServer instance.| Constructor | Description |
|---|---|
SNMP4JAgentSnmpService(org.snmp4j.agent.MOServer[] moServers) |
Create a
SnmpService based on an array of managed object servers. |
| Modifier and Type | Method | Description |
|---|---|---|
List<? extends SnmpCommitResult> |
commit(SnmpTransaction transaction,
SnmpCommitListener commitListener) |
Commits the transaction to the agent.
|
List<? extends org.snmp4j.smi.VariableBinding> |
get(org.snmp4j.Target target,
List<org.snmp4j.smi.OID> oidList) |
Gets the SNMP values for the specified OIDs.
|
List<? extends org.snmp4j.smi.VariableBinding> |
getNext(org.snmp4j.Target target,
List<org.snmp4j.smi.OID> oidList) |
Gets the next following SNMP values for the specified OIDs.
|
SnmpTransaction |
getSnmpTransaction(SnmpTransactionStrategy transactionStrategy) |
|
List<? extends org.snmp4j.smi.VariableBinding> |
getSubTree(org.snmp4j.Target target,
org.snmp4j.smi.OID oid) |
Gets the SNMP values for the specified sub-tree root OID.
|
List<? extends SnmpRow> |
getTable(org.snmp4j.Target target,
List<org.snmp4j.smi.OID> columnOIDs,
org.snmp4j.smi.OID minIndex,
org.snmp4j.smi.OID maxIndex) |
Gets the rows of a SNMP table synchronously.
|
void |
getTable(org.snmp4j.Target target,
List<org.snmp4j.smi.OID> columnOIDs,
org.snmp4j.smi.OID minIndex,
org.snmp4j.smi.OID maxIndex,
SnmpRowListener callback,
Object userObject) |
Gets the rows of a SNMP table asynchronously.
|
void |
initTransports() |
Initializes the transports associated with this service.
|
boolean |
isAtomic(SnmpTransaction transaction) |
Checks if this transaction can be committed with atomicity.
|
void |
rollback(SnmpTransaction transaction) |
|
void |
update(SnmpTransaction snmpTransaction,
org.snmp4j.Target target,
SnmpValuesChangeSet variableBindings,
SnmpCommitListener snmpCommitListener) |
Updates (SETs) a set of changes with an atomic SET operation asynchronously.
|
public SNMP4JAgentSnmpService(org.snmp4j.agent.MOServer[] moServers)
SnmpService based on an array of managed object servers.moServers - an array of MOServer instances that serve the managed objects available for this SNMP service.public void initTransports()
throws IOException
SnmpServiceinitTransports in interface SnmpServiceIOException - if an IO error occurred during initialization.public List<? extends org.snmp4j.smi.VariableBinding> get(org.snmp4j.Target target, List<org.snmp4j.smi.OID> oidList) throws SnmpException
SnmpServiceget in interface SnmpServicetarget - the SNMP target to send the SNMP PDUs to.oidList - the instance object identifiers to GET values for.SnmpException - if an SNMP error or timeout occurred.public List<? extends org.snmp4j.smi.VariableBinding> getNext(org.snmp4j.Target target, List<org.snmp4j.smi.OID> oidList) throws SnmpException
SnmpServicegetNext in interface SnmpServicetarget - the SNMP target to send the SNMP PDUs to.oidList - the instance object identifiers to GET-NEXT values for.SnmpException - if an SNMP error or timeout occurred.public List<? extends org.snmp4j.smi.VariableBinding> getSubTree(org.snmp4j.Target target, org.snmp4j.smi.OID oid) throws SnmpException
SnmpServicegetSubTree in interface SnmpServicetarget - the SNMP target to send the SNMP PDUs to.oid - the root OID of the sub-tree to get values for (using GETBULK or GETNEXT).SnmpException - if an SNMP error or timeout occurred.public List<? extends SnmpRow> getTable(org.snmp4j.Target target, List<org.snmp4j.smi.OID> columnOIDs, org.snmp4j.smi.OID minIndex, org.snmp4j.smi.OID maxIndex) throws SnmpException
SnmpServicegetTable in interface SnmpServicetarget - the SNMP target to send the SNMP PDUs to.columnOIDs - the OIDs of the columns to retrieve (columns might be combined from several tables although the indexes
of the included tables should then contain a common prefix).minIndex - the minimum index to return (or null for no limit).maxIndex - the maximum index to return (or null for no limit).SnmpRow instances.SnmpException - if an SNMP error or timeout occurred.public void getTable(org.snmp4j.Target target,
List<org.snmp4j.smi.OID> columnOIDs,
org.snmp4j.smi.OID minIndex,
org.snmp4j.smi.OID maxIndex,
SnmpRowListener callback,
Object userObject)
throws SnmpException
SnmpServicegetTable in interface SnmpServicetarget - the SNMP target to send the SNMP PDUs to.columnOIDs - the OIDs of the columns to retrieve (columns might be combined from several tables although the indexes
of the included tables should then contain a common prefix).minIndex - the minimum index to return (or null for no limit).maxIndex - the maximum index to return (or null for no limit).callback - the callback that receives the retrieved rows.userObject - an optinal user object to be associated with this retrieval.SnmpException - if an SNMP error or timeout occurred.public void update(SnmpTransaction snmpTransaction, org.snmp4j.Target target, SnmpValuesChangeSet variableBindings, SnmpCommitListener snmpCommitListener)
SnmpServiceupdate in interface SnmpServicesnmpTransaction - the transaction that controls this update.target - the SNMP target.variableBindings - the change set to commit to the agent identified by target.snmpCommitListener - a listener for commit events.public List<? extends SnmpCommitResult> commit(SnmpTransaction transaction, SnmpCommitListener commitListener)
TransactionManagercommit in interface TransactionManagertransaction - the transaction to commit.commitListener - the optional listener that is immediately informed during this commit call about
failures and successful committed change sets.SnmpErrorStatus indicating success or failure reason
of the transaction.public void rollback(SnmpTransaction transaction)
rollback in interface TransactionManagerpublic SnmpTransaction getSnmpTransaction(SnmpTransactionStrategy transactionStrategy)
getSnmpTransaction in interface TransactionManagerpublic boolean isAtomic(SnmpTransaction transaction)
TransactionManagerfalse.isAtomic in interface TransactionManagertransaction - the transaction to test.true if this transaction can be committed by using a single
SET PDU. Thus, the variables to set do not exceed the target's maximum
size PDU length (including estimated SNMP message overhead).Copyright © 2020 SNMP4J.org. All rights reserved.