public class TestSubagent extends Object implements Runnable, org.snmp4j.transport.TransportStateListener, RegistrationCallback
TestSubagent is an example implementation of a simple
AgentX subagent with shared tables and multi context registration.| Modifier and Type | Field and Description |
|---|---|
static org.snmp4j.smi.OID |
SUBAGENT_ID |
| Constructor and Description |
|---|
TestSubagent(org.snmp4j.smi.Address masterAddress,
org.snmp4j.smi.Address localAddress) |
| Modifier and Type | Method and Description |
|---|---|
void |
connectionStateChanged(org.snmp4j.transport.TransportStateEvent change) |
static void |
main(String[] args) |
protected void |
register() |
protected void |
registerSessionDependent() |
void |
registrationEvent(org.snmp4j.smi.OctetString context,
org.snmp4j.agent.ManagedObject mo,
int status)
The registration attempt of a
ManagedObject succeeded or
failed. |
void |
run() |
boolean |
tableRegistrationEvent(org.snmp4j.smi.OctetString context,
org.snmp4j.agent.mo.MOTable mo,
org.snmp4j.agent.mo.MOTableRow row,
boolean indexAllocation,
int status,
int retryCount)
The registration attempt of a
ManagedObject succeeded or
failed. |
void |
tableUnregistrationEvent(org.snmp4j.smi.OctetString context,
org.snmp4j.agent.mo.MOTable mo,
org.snmp4j.agent.mo.MOTableRow row,
boolean indexAllocation,
int status)
The unregistration attempt of a
ManagedObject succeeded or
failed. |
protected void |
unregisterFailed(List failedRegistrations)
Remove objects from the server, which could not be registered with
the master agent.
|
protected void |
unregisterSessionDependent() |
void |
unregistrationEvent(org.snmp4j.smi.OctetString context,
org.snmp4j.agent.ManagedObject mo,
int status)
The unregistration attempt of a
ManagedObject succeeded or
failed. |
public TestSubagent(org.snmp4j.smi.Address masterAddress,
org.snmp4j.smi.Address localAddress)
public static void main(String[] args)
protected void register()
throws org.snmp4j.agent.DuplicateRegistrationException
org.snmp4j.agent.DuplicateRegistrationExceptionprotected void unregisterSessionDependent()
protected void registerSessionDependent()
throws org.snmp4j.agent.DuplicateRegistrationException
org.snmp4j.agent.DuplicateRegistrationExceptionprotected void unregisterFailed(List failedRegistrations)
failedRegistrations - a List of ManagedObjects and MOTableRows which failed to register.public void connectionStateChanged(org.snmp4j.transport.TransportStateEvent change)
connectionStateChanged in interface org.snmp4j.transport.TransportStateListenerpublic void registrationEvent(org.snmp4j.smi.OctetString context,
org.snmp4j.agent.ManagedObject mo,
int status)
RegistrationCallbackManagedObject succeeded or
failed.registrationEvent in interface RegistrationCallbackcontext - the registration context.mo - the ManagedObject that was subject to the registration
process.status - the AgentX status of the registration response.public boolean tableRegistrationEvent(org.snmp4j.smi.OctetString context,
org.snmp4j.agent.mo.MOTable mo,
org.snmp4j.agent.mo.MOTableRow row,
boolean indexAllocation,
int status,
int retryCount)
RegistrationCallbackManagedObject succeeded or
failed.tableRegistrationEvent in interface RegistrationCallbackcontext - the registration context.mo - the MOTable that was subject to the registration
process.row - the row whose index or region was subject to the
allocation/registration.indexAllocation - true if this event relates to an index allocation
request and false if it relates to a row region
registration.status - the AgentX status of the registration response.retryCount - the number of retries already processed. This value can be used to
avoid endless loops.true if the caller should retry the registration operation,
false otherwise.public void unregistrationEvent(org.snmp4j.smi.OctetString context,
org.snmp4j.agent.ManagedObject mo,
int status)
RegistrationCallbackManagedObject succeeded or
failed.unregistrationEvent in interface RegistrationCallbackcontext - the registration context.mo - the ManagedObject that was subject to the registration
process.status - the AgentX status of the registration response.public void tableUnregistrationEvent(org.snmp4j.smi.OctetString context,
org.snmp4j.agent.mo.MOTable mo,
org.snmp4j.agent.mo.MOTableRow row,
boolean indexAllocation,
int status)
RegistrationCallbackManagedObject succeeded or
failed.tableUnregistrationEvent in interface RegistrationCallbackcontext - the registration context.mo - the MOTable that was subject to the registration
process.row - the row whose index or region was subject to the
allocation/registration.indexAllocation - true if this event relates to an index allocation
request and false if it relates to a row region
registration.status - the AgentX status of the registration response.Copyright © 2020 SNMP4J.org. All rights reserved.