5.15.5 Request Polling Server

 



 

Overview

 

An integral part of the network management is to monitor the infrastructure of networks. The monitoring is done by collecting various information from the devices in the network. ManagementServer helps the Network Management Applications in collecting the details from the network devices (supporting protocols like SNMP v1/v2c/v3, TL1, CLI) that can be used in determining the performance and health of the network.

 

The following image depicts the Request Polling Server Architecture.

 

 

The following are the sequential steps that explains how the application register/unregister for receiving periodic responses from Management Server and how the Management Server polls the device.

 

Register for Polling

 



Application gets the Instance of Management Server

 

The application gets the instance of ManagementServer.

 

ManagementServer ms = (ManagementServer) ManagementServicesAPI.getInstance(new String[]{""},2);

 

This will return an Instance of ManagementServer which is a singleton instance.

 

Application constructs a Request Property

 

The application assembles a request in the form Property.

 

For example, in case of SNMP,

 

SnmpProperty property = new SnmpProperty();

property.setTargetHost("<targetHost>");

property.setTargetPort("<targetPort>");

property.setObjectID("1.1.0");

property.setOperationType(Property.OP_READ);

property.setPollingInterval(10000);

 

If the value corresponding to the "pollInterval" parameter is set greater than "0", then polling will be performed at the specified interval and if it is set as "0" then polling will be done only once. In the above case the polling will be scheduled at every 10 seconds.

 

In order to receive the result from the polling, the application has to implement the ProtocolListener interface. Sample implementation of the same is given below:

 

public MyProtocolListenerImpl implements ProtocolListener

{

public void setProtocolResult(Property prop, Object result)

{

// user specific implementation.

}

public void processError(Property prop, int errorIndex, String errorMessage)

 

// user specific implementation.

}

public void processError(Property prop, Object errorObject )

{

// user specific implementation.

}

}

 

Application has to set the ProtocolListener implementation class (say MyProtocolListenerImpl) in the request Property.

 

Property.setComponent(protListenerImpl);

 

When the result of the request is received, the setProtocolResult() method of the ProtocolListener's implementation (MyProtocolListenerImpl) class will be invoked.

 

In case of any error processError() method of the same will be invoked with error details.

 

In case of connection oriented protocols, a session has to be established between the application and the device.

 

String sessionId = ms.establishSession(Property) ;(Property should contain the TargetHost and TragetPort.(minimum) )

 

The sessionId that is obtained has to be set in the Property Object for further transactions between the application and the device.

 

Property.setSessionId(sessionId);

 

Application registers with Management Server

 

The application registers with the Management Server to receive periodic responses.

 

ManagementServer.registerClient(Property);

      Note:

      1. The ProtocolProperty Object used to start polling (used for invoking registerClient()) has to be used when the application want's to stop polling.

      2. To achieve synchronous communication mode, set the value of setOperationType() method of Property Object to SYNC_COMM. This causes the syncSend() method to be invoked instead of the send() method.

Management Server registers with the provider for polling

 

The Management Server generates a request id, maintains the mapping between requestId and Property internally and it sets the requestId in the Property.

 

Property.setRequestId(requestId);

 

The Management Server loads the default parameters from conf files. For example in case of SNMP it loads from the SnmpDefaultParameters.xml present in the <WebNMS_HOME>/conf directory.

 

Then Management Server sends the ProtocolProperty to the ProtocolProvider and schedules the property for next polling after a time interval equal to the polling interval.

 

Protocol Provider polls the device

 

The ProtocolProvider assembles the requestPDU based on the ProtocolProperty submitted and sends the PDU to the device.

 

Protocol Provider Constructs ManagementServerResultEvent and sends it to Management Server

 

On receiving the response PDU from the device, the Protocol Provider converts the response PDU into a java object (say resultObject ) which is a non-protocol specific response. (eg., a String array, Properties, XML Document etc.,). It sets the response in the generic response ManagementServerResultEvent as follows,

 

ManagementServerResultEvent msre = new ManagementServerResultEvent(); msre.setResult(response);

 

During the initialization phase of the Management Server, it registers itself as a callback listener to receive the asynchronous responses from the ProtocolProvider using ProtocolProvider.setCallMSCallbackListener(MSCallbackListener). Then the Protocol Provider returns the ManagementServerResultEvent to the ManagementServer through this MSCallbackListener.

 

Response sent to registered application

 

The Management Server gets the request Property corresponding to the requestId from the requestId-to-Property mapping which it maintains internally.

 

If the response obtained has error set in it, then ProtocolListener Implementation class set in Property is obtained using Property.getComponent() and the processError method of the same is called with the error details.

 

When no error set in the response, then ManagementServer invokes the setProtocolResult method of the ProtocolListener's implementation class set in Property object and returns the result (ManagmentServerResultEvent) to the application .

 

ProtocolListener lis = (ProtocolListener) property.getComponent(); lis.setProtocolResult(property, result);

 

Unregister from polling

 

The application has to perform the following to unregister itself from receiving periodic responses from polling.

 

ms.unregisterClient(property);

 

Note: The Property instance used by the application to unregister from polling should be the same instance that was used while registering for polling with ManagementServer



Copyright © 2011, ZOHO Corp. All Rights Reserved.