AdventNet Web NMS 4 API Specification

com.adventnet.nms.netwatch
Interface UserTester


public interface UserTester

This is the interface that has to be implemented to configure status polling. The status of the ManagedObject is then periodically checked by the status poller written by the user using this interface.

For the ManagedObjects in the topology database, having the tester property set as usertest, the status poller will invoke the class specified in its uClass property. Users have to specify the fully qualified class name, implementing this interface, in the uClass property of the ManagedObject. This can be done in the discovery filters or specified in the OIDType.data configuration file.


Method Summary
 int test(ManagedObject obj, TopoAPI api)
          This user-defined method is run by the status poller, and will be called whenever the ManagedObject is status-polled at the scheduled time interval.
 

Method Detail

test

public int test(ManagedObject obj,
                TopoAPI api)
This user-defined method is run by the status poller, and will be called whenever the ManagedObject is status-polled at the scheduled time interval.

The return value determines the status of the object. A return value of -1 indicates the existing status is unchanged. If the return value does not match the current value, an event with the specified severity is generated which, when processed into an alert, will ensure that the status of the managed object is accordingly updated.

It is important to note that just changing the status of the ManagedObject will not have any effect. Care should also be taken to see that the user tester does not try to use the TopoAPI methods and update the status directly which will circumvent the status update mechanism via events and alerts.

In case it is neccessary to change some other property of the ManagedObject, other than status, this method can call the TopoAPI.updateObject method, but without any change in the status.

 Example case scenarios:
 	After performing some test

    case  a)    no changes are required.
                  then just do a 
                        return -1;

    case  b)   status alone needs to be changed
                   return  newStatus;

    case  c)   some other property needs to be changed.
               say a user property "myprop" has to change to a new value 
               "mynewvalue", then you will have to do :
 
		obj.setUserProperty("myprop","mynewvalue");
		api.updateObject(obj); // status should not be changed
		return newStatus;
 
 Note: The status of the object has not at all been touched, though it is 
 possible to have changed the status before calling updateObject. This has 
 to be followed to ensure that status updates are channelized through the 
 correct mechanism of event --> alert --> status update.
 
Parameters:
obj - The ManagedObject for which the user tester is to be run.
api - The TopoAPI instance to perform the required database operations.
Returns:
The status as an integer value corresponding to one of the severity values of the ManagedObject after the user tester is run.

AdventNet Web NMS 4 API Specification