Heart beat Mechanism

Introduction:

This application will demonstrate how to enable heartbeat mechanism in master subagent architecture.  Heart beat mechanism will periodically poll the subagents and update the status of the subagents in the proxytable of master agent.

Overview:

This example is generated with oidBased proxy option and heart beat Mechanism option enabled in the MibCompiler->Project -> Settings->Proxy- panel. (for all type of proxies heartbeat mechanism feature is supported)

Subagent entry is added for oid(OID - .1.3.6.1.2.1.1 ) and the port as 8010 in ProxyTable.

In this case, the Master Agent can be run at any port and the subagent should be started at 8010. Once the Master Agent is started the Master Agent will start polling the Subagent and update the status of the Subagent in the proxytable. Using the status, the Master Agent will decide whether further queries can be forwarded to the Subagent or not. If the poller updates the status of the Subagent as NOT_IN_SERVICE then the Master Agent will not forward the queries to the subagent further. The Master Agent itself will send an error response to the manager. Only if the status of the Subagent entry is ACTIVE, the Master Agent will forward the request to the Subagent, get the response and send it back to the Manager. Whenever the poller changes the status (from ACTIVE to NOT_IN_SERVICE or from  NOT_IN_SERVICE to ACTIVE) of the subagent entry, a Trap will be sent to all the registered Managers with the Subagent details.

Source files:

1. Master Agent:

MasterAgent.java

* DynamicRegistration class is instantiated.

* Created instance is registered with PduRequestHandler.

* Heart beat will be enabled by calling the method checkSubAgentHeartBeat() of DynamicRegistration class .

2. SubAgent:

Subagent is generated for RFC1213-MIB.

Compilation:

1. Go to <Installation Directory>\WebNMS\JavaAgent\examples\snmp\proxy\heartbeat\agent\bin directory and compile the source using,

    sh compile.sh (for Linux users) OR
    compile (for Windows Users)

Starting the Agents:

1. Start the Master Agent from <Installation Directory>\WebNMS\JavaAgent\examples\snmp\proxy\heartbeat\agent\bin directory using,

    sh run.sh (for Linux users) OR
    run(for Windows Users)

2. Start the Subagent from <Installation Directory>\WebNMS\JavaAgent\examples\snmp\proxy\subagent\agent\bin directory

    sh run.sh (for Linux users) OR
    run (for Windows Users)
 

Now query any oid under .1.3.6.1.2.1.2 of  RFC1213-MIB.  The Master Agent will proxy the request to localhost, port 8010 and send back the response. If you have stopped the Subagent and then if you tried to query the Master Agent then the Master Agent will immediately send a general failure response to the Manager as the poller would have been updated the entry status as NOT_IN_SERVICE.
 

AdventNet oval logo
Copyright (c) 2009  ZOHO Corp. All Rights Reserved.