|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ireasoning.core.jmx.BaseAgent com.ireasoning.protocol.snmp.SnmpBaseAgent com.ireasoning.protocol.snmp.SnmpAgentX
This class provides support for AgentX protocol, a master/subagent architecture specified in RFC 2741. RFC 2741 defines a standardized framework for extensible SNMP agents, it defines processing entities called master agents and subagents, a protocol (AgentX) used to communicate between them, and the elements of procedure by which the extensible agent processes SNMP protocol messages.
Field Summary |
Fields inherited from class com.ireasoning.protocol.snmp.SnmpBaseAgent |
_configFileName, _port, _root, _shouldExit, _snmpAdaptorServer, AUTHENTICATION_FAILURE_TRAP, AUTHENTICATION_FAILURE_TRAP_OID, COLD_START_TRAP, COLD_START_TRAP_OID, EGPNEIGHBOR_LOSS_OID, EGPNEIGHBOR_LOSS_TRAP, LINK_DOWN_TRAP, LINK_DOWN_TRAP_OID, LINK_UP_TRAP, LINK_UP_TRAP_OID, SNMP_TRAP_OID, SYS_UP_TIME_OID, WARM_START_TRAP, WARM_START_TRAP_OID |
Fields inherited from class com.ireasoning.core.jmx.BaseAgent |
_mbeanServer |
Constructor Summary | |
protected |
SnmpAgentX()
Creates subagent only SnmpAgentX instance, without any config file |
protected |
SnmpAgentX(MBeanServer server)
Creates subagent only SnmpAgentX instance, without any config file |
protected |
SnmpAgentX(MBeanServer server,
DefaultAgentConfig config,
boolean noStandardSnmpAgent,
boolean startAgentAutomatically)
Constructor. |
protected |
SnmpAgentX(MBeanServer server,
int port,
DefaultAgentConfig config,
boolean startAgentAutomatically)
Constructor. |
protected |
SnmpAgentX(MBeanServer server,
Object configFileNameOrInputStream,
boolean noStandardSnmpAgent)
Constructor. |
protected |
SnmpAgentX(MBeanServer server,
Object configFileNameOrInputStream,
boolean noStandardSnmpAgent,
boolean startAgentAutomatically)
Constructor. |
protected |
SnmpAgentX(Object configFileNameOrInputStream,
boolean noStandardSnmpAgent)
Constructor. |
Method Summary | |
void |
addSubagentEventListener(Listener listener)
This method allows the registration of event listeners. |
protected SnmpError |
allocateTableIndices(SnmpVarBind[] vbs,
boolean isNewIndex,
boolean isAnyIndex)
This method must be implemented to process agentx-IndexAllocate-PDU. |
SubAgentSession |
connect(String masterAgentHostName,
int port)
Connects this subagent to master agent. |
protected SnmpError |
deallocateTableIndices(SnmpVarBind[] vbs)
This method must be implemented to process agentx-IndexDeallocate-PDU. |
long |
getMasterAgentSysUpTime()
Returns the sysUptime of master agent, in hundredth of a second. |
List |
getRegisteredSubtrees()
|
void |
removeSubagentEventListener(Listener listener)
This method allows the removal of event listeners from the event target. |
static boolean |
sendTrapToMasterAgents(SnmpTrap trap)
Sends out trap to all connected master agents. |
void |
startMasterAgent()
Starts master agent listening on port specified in the agent config file ( properties:masterAgentPort field ) |
void |
startMasterAgent(int port)
Starts master agent. |
void |
stopMasterAgent()
Stops master agent whose port is specified in config file's masterAgentPort field |
void |
stopMasterAgent(int port)
Stops master agent |
Methods inherited from class com.ireasoning.core.jmx.BaseAgent |
getMBeanServer, registerHelperMBeans, startAdaptorServer, startAdaptorServer, stopAdaptorServer, stopAdaptorServer, unregisterHelperMBeans |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected SnmpAgentX() throws Exception
protected SnmpAgentX(MBeanServer server) throws Exception
protected SnmpAgentX(Object configFileNameOrInputStream, boolean noStandardSnmpAgent) throws Exception
configFileNameOrInputStream
- config file name or InputStream
object. If it's a file name and the file does not exist, code'll try locating it at ./config/ directory. If it's an instance of InputStream, it'll be closed when config is loaded.noStandardSnmpAgent
- if true, it does not start an SNMP agent to accept SNMP requests directly, intead,
SNMP requests are passed from master agent. Otherwise, a standard agent will be started on the port number
specified in the config file.protected SnmpAgentX(MBeanServer server, Object configFileNameOrInputStream, boolean noStandardSnmpAgent) throws Exception
server
- the MBeanServer object which is to be used to create/register MBeansnoStandardSnmpAgent
- if true, it does not start an SNMP agent to accept SNMP requests directly, intead,
SNMP requests are passed from master agent. Otherwise, a standard agent will be started on the port number
specified in the config file.configFileNameOrInputStream
- config file name or InputStream
object. If it's a file name and the file does not exist, code'll try locating it at ./config/ directory. If it's an instance of InputStream, it'll be closed when config is loaded.protected SnmpAgentX(MBeanServer server, Object configFileNameOrInputStream, boolean noStandardSnmpAgent, boolean startAgentAutomatically) throws Exception
server
- the MBeanServer object which is to be used to create/register MBeansnoStandardSnmpAgent
- if true, it does not start an SNMP agent to accept SNMP requests directly, intead,
SNMP requests are passed from master agent. Otherwise, a standard agent will be started on the port number
specified in the config file.configFileNameOrInputStream
- config file name or InputStream
object. If it's a file name and the file does not exist, code'll try locating it at ./config/ directory. If it's an instance of InputStream, it'll be closed when config is loaded.startAgentAutomatically
- if true, start()
doesn't need to be called, this constructor will call it automatically.
Otherwise you need to call that method after instanticating this class to start agent.protected SnmpAgentX(MBeanServer server, DefaultAgentConfig config, boolean noStandardSnmpAgent, boolean startAgentAutomatically) throws Exception
server
- the MBeanServer object which is to be used to create/register MBeansnoStandardSnmpAgent
- if true, it does not start an SNMP agent to accept SNMP requests directly, intead,
SNMP requests are passed from master agent. Otherwise, a standard agent will be started on the port number
specified in the config file.config
- the config objectstartAgentAutomatically
- if true, start()
doesn't need to be called, this constructor will call it automatically.
Otherwise you need to call that method after instanticating this class to start agent.protected SnmpAgentX(MBeanServer server, int port, DefaultAgentConfig config, boolean startAgentAutomatically) throws Exception
startAgentAutomatically
is false.
server
- the MBeanServer object which is to be used to create/register MBeans.
If the passed server
is null, an MBeanServer instance will be created.port
- Agent's UDP port numberconfig
- the config Object for this agentstartAgentAutomatically
- if true, start()
doesn't need to be called, this constructor will call it automatically.
Otherwise you need to call that method after instanticating this class to start agent.Method Detail |
public void startMasterAgent() throws IOException
IOException
public void startMasterAgent(int port) throws IOException
port
- master agent listening TCP port, which listens for subagent connections.
This port is different from standard SNMP agent UDP port (161), which is used to accept
UDP requests.
IOException
public void stopMasterAgent()
stopMasterAgent(int port)
public void stopMasterAgent(int port)
port
- the TCP port number of the master agent to be stoppedstartMasterAgent(int port)
public SubAgentSession connect(String masterAgentHostName, int port) throws IOException
masterAgentHostName
- the host name or ip address of master agentport
- master agent listening port, 705 (TCP port) by default
IOException
public long getMasterAgentSysUpTime()
protected SnmpError allocateTableIndices(SnmpVarBind[] vbs, boolean isNewIndex, boolean isAnyIndex)
Each passed SnmpVarBind
in the array is processed until either all are successful, or one fails.
If any VarBind fails, it returns an SnmpError
object with its errorIndex set to indicate the failed VarBind,
and its errorStatus set a constant in AgentXConst
. All other VarBinds are ignored; no index values are allocated.
If both the isNewIndex and isAnyIndex are false, allocation of a specific index value is being requested. If the requested index is already allocated for v.name in the indicated context, the VarBind fails and returned errorStatus is set to AgentXConst.INDEX_ALREADY_ALLOCATED.
vbs
- VarBind list contained in the received PDUisNewIndex
- if true, the master agent should generate the next available index value for name of
the VarBind in the indicated context, with the constraint that this value must not have been allocated
(even if subsequently released) to any subagent since the last re-initialization of the master agent.
If no such value can be generated, the VarBind fails and returned errorStatus is set to AgentXConst.INDEX_NONE_AVAILABLE.isAnyIndex
- if true, the master agent should generate an index value for name of the VarBind in the
indicated context, with the constraint that this value is not currently allocated to any subagent.
If no such value can be generated, then the VarBind fails and returned errorStatus is set to AgentXConst.INDEX_NONE_AVAILABLE.
protected SnmpError deallocateTableIndices(SnmpVarBind[] vbs)
Each passed SnmpVarBind is processed until either all are successful, or one fails.
If any VarBind fails, it returns an SnmpError object with its errorIndex set to indicate
the failed VarBind, and its errorStatus set a constant in AgentXConst
.
All other VarBinds are ignored; no index values are released.
vbs
- VarBind list contained in the received PDU
public List getRegisteredSubtrees()
public static boolean sendTrapToMasterAgents(SnmpTrap trap) throws IOException
IOException
- raised if trap can't be sent to master agentpublic void addSubagentEventListener(Listener listener)
listener
- an object which implements Listener interfaceListener.handleMsg(java.lang.Object, com.ireasoning.protocol.Msg)
public void removeSubagentEventListener(Listener listener)
listener
- an object which implements Listener interface
|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |