public class AgentXMasterAgent extends AgentConfigManager implements TransportStateListener
AgentXMasterAgent
is the base agent class for
AgentX master agents. It extends the AgentConfigManager
class
provided by SNMP4J-Agent.
To implement a master agent, simply extend this class instead of
AgentConfigManager
as you would do for a non-AgentX agent.
AgentConfigManager.AgentState
agent, communityMIB, configuration, defaultContext, dispatcher, engineBootsProvider, engineID, frameworkMIB, moFactory, notificaitonLogGlobalAge, notificaitonLogGlobalLimit, notificationLogDefaultLimit, notificationLogMIB, notificationMIB, notificationOriginator, persistenceImportMode, persistenceProvider, proxyForwarder, proxyMIB, runState, servers, session, snmp4jConfigMIB, snmp4jLogMIB, snmp4jProxyMIB, snmpv2MIB, STATE_CONFIGURED, STATE_CREATED, STATE_INITIALIZED, STATE_RESTORED, STATE_RUNNING, STATE_SAVED, STATE_SHUTDOWN, STATE_SUSPENDED, STATE_UNSAVED_CHANGES, sysDescr, sysOID, sysServices, tableSizeLimit, targetMIB, tlsTmMib, usm, usmMIB, vacm, vacmMIB, workerPool
Constructor and Description |
---|
AgentXMasterAgent(File bootCounterFile,
File configFile)
Creates a simple AgentX master agent using a boot counter file and
config file for persistent storage.
|
AgentXMasterAgent(OctetString agentsOwnEngineID,
MessageDispatcher messageDispatcher,
VACM vacm,
MOServer[] moServers,
WorkerPool workerPool,
MOInputFactory configurationFactory,
MOPersistenceProvider persistenceProvider,
EngineBootsProvider engineBootsProvider)
Creates a SNMP agent configuration which can be run by calling
AgentConfigManager.run() later. |
Modifier and Type | Method and Description |
---|---|
void |
addAgentXTransportMapping(TransportMapping transport) |
void |
connectionStateChanged(TransportStateEvent change) |
protected CommandProcessor |
createCommandProcessor(OctetString engineID)
Creates the command processor.
|
AgentXMib |
getAgentXMIB() |
AgentXCommandProcessor |
getCommandProcessor() |
OctetString |
getLocalEngineID()
Gets the local engine ID.
|
static short |
getMaxGetBulkRepetitions()
Gets the upper limit for AgentX Get Bulk repetitions field send on behalf
of all master agents of this JVM.
|
boolean |
isLocalhostSubagentsOnly()
Indicates whether only subagents from the local host or from any host
are allowed to connect to this master agent (default is any host).
|
protected void |
launchTransportMappings()
Launch (or relaunch) AgentX transport mappings.
|
protected void |
registerMIBs(OctetString context) |
void |
removeAgentXTransportMapping(TransportMapping transport) |
void |
setLocalEngineID(OctetString localEngineID)
Sets the local engine ID.
|
void |
setLocalhostSubagentsOnly(boolean localhostSubagentsOnly)
Sets the local host only connection filter flag.
|
static void |
setMaxGetBulkRepetitions(short maxRepetitions)
Sets the maximum repetitions value used by this master agent for its
AgentX Get Bulk requests to subagents.
|
void |
shutdown()
Shutdown communication be stopping all AgentX transport mappings.
|
protected void |
unregisterMIBs(OctetString context) |
configure, continueProcessing, createNotificationOriginator, createProxyForwarder, createSnmpSession, createTSM, createUSM, fireLaunchNotifications, getAgentNotificationOriginator, getContext, getDefaultContext, getNotificationLogMIB, getNotificationOriginator, getPersistenceImportMode, getSnmp4jConfigMIB, getSnmp4jLogMIB, getSnmp4jProxyMIB, getSnmpCommunityMIB, getSnmpNotificationMIB, getSnmpTargetMIB, getSNMPv2MIB, getState, getSupportedSecurityProtocols, getSysDescr, getSysOID, getSysServices, getSysUpTime, getUsm, getUsmMIB, getVACM, getVacmMIB, initialize, initMandatoryMIBs, initMessageDispatcherWithMPs, initNotificationLogMIB, initOptionalMIBs, initSecurityModels, initSnmp4jConfigMIB, initSnmp4jLogMIB, initSnmp4jProxyMIB, launch, launchTransportMappings, linkCounterListener, registerShutdownHook, registerTransportMappings, restoreState, run, saveState, setNotificationOriginator, setPersistenceImportMode, setTableSizeLimit, setTableSizeLimits, setupProxyForwarder, stopTransportMappings, suspendProcessing
public AgentXMasterAgent(OctetString agentsOwnEngineID, MessageDispatcher messageDispatcher, VACM vacm, MOServer[] moServers, WorkerPool workerPool, MOInputFactory configurationFactory, MOPersistenceProvider persistenceProvider, EngineBootsProvider engineBootsProvider)
AgentConfigManager.run()
later.agentsOwnEngineID
- the authoritative engine ID of the agent.messageDispatcher
- the MessageDispatcher to use. The message dispatcher must be configured
outside, i.e. transport mappings have to be added before this
constructor is being called.vacm
- a view access control model. Typically, this parameter is set to
null
to use the default VACM associated with the
VacmMIB
.moServers
- the managed object server(s) that server the managed objects available
to this agent.workerPool
- the WorkerPool
to be used to process incoming request.configurationFactory
- a MOInputFactory
that creates a MOInput
stream
with containing serialized ManagedObject information with the agent's
configuration or null
otherwise.persistenceProvider
- the primary MOPersistenceProvider
to be used to load
and store persistent MOs.engineBootsProvider
- the provider of engine boots counter.public AgentXMasterAgent(File bootCounterFile, File configFile)
bootCounterFile
- a file that stores the boot counter.configFile
- a file that stores persistent MIB data.protected CommandProcessor createCommandProcessor(OctetString engineID)
createCommandProcessor
in class AgentConfigManager
engineID
- the engine ID of the agent.public void addAgentXTransportMapping(TransportMapping transport)
public void removeAgentXTransportMapping(TransportMapping transport)
public static short getMaxGetBulkRepetitions()
setMaxGetBulkRepetitions(short)
public AgentXMib getAgentXMIB()
public AgentXCommandProcessor getCommandProcessor()
public OctetString getLocalEngineID()
public boolean isLocalhostSubagentsOnly()
true
if only connections from the local host are allowed
and false
if connections from any host are allowed.public static void setMaxGetBulkRepetitions(short maxRepetitions)
The NET-SNMP AgentX sub-agent has a bug in its AgentX Get Bulk processing that causes endless loops in the sub-agent when the max-repetitions value is greater than one. Since this bug is in NET-SNMP since v4.2 and still present in version 5.4, it is likely, that you will need to set this value to one, if your master agent should ever communicate with a NET-SNMP sub-agent.
maxRepetitions
- the upper limit of the maximum repetitions for AgentX Get Bulk
sub-requests.public void setLocalEngineID(OctetString localEngineID)
AgentConfigManager.initialize()
has been called for the first time.localEngineID
- the (authoritative) engine ID of the master agent.public void setLocalhostSubagentsOnly(boolean localhostSubagentsOnly)
localhostSubagentsOnly
- true
if only connections from the local host are allowed
and false
if connections from any host are allowed.public void connectionStateChanged(TransportStateEvent change)
connectionStateChanged
in interface TransportStateListener
protected void registerMIBs(OctetString context) throws DuplicateRegistrationException
registerMIBs
in class AgentConfigManager
DuplicateRegistrationException
protected void unregisterMIBs(OctetString context)
unregisterMIBs
in class AgentConfigManager
protected void launchTransportMappings() throws IOException
launchTransportMappings
in class AgentConfigManager
IOException
- if the necessary ports could not be opened or bound.public void shutdown()
shutdown
in class AgentConfigManager
Copyright © 2016 SNMP4J.org. All rights reserved.