"WEBNMS_5 API Docs"

com.adventnet.nms.alertdb
Interface AlertAPI

All Superinterfaces:
CommonAPI, CommonModuleAPI, java.rmi.Remote

public interface AlertAPI
extends CommonAPI

This API is for accessing and managing Alert objects in the Alert Database. It contains necessary methods for adding and removing AlertListeners. Various Alert related operations like clearing,deleting and picking/unpicking of Alerts, can be done using this API's methods. Moreover, this API has necessary methods for getting Annotation and History for Alert objects.

This API is accessible either through RMI or directly from the same JVM. When RMI is enabled, i.e. by running RMI registry before starting NMS server, AlertAPI can be accessed remotely via RMI.

The following code snippet can be used to get AlertAPI handle in secured and authenticated mode through RMI. In this mode, NMS needs userName and password to provide AlertAPI handle.

 
 try
 {
    RMIAccessAPI rmiapi = (RMIAccessAPI)Naming.lookup("//hostName/RMIAccessAPI");
    AlertAPI api = (AlertAPI)rmiapi.getAPI("userName","password","AlertAPI");
 }
 catch(Exception ee)
 {
     System.out.println("Error in getting AlertAPI handle");
     ee.printStackTrace();
 }
 
 

The following code snippet can be used to get AlertAPI handle through RMI, without RMI security mechanism of NMS.

 
 try
 {
     AlertAPI api = (AlertAPI)Naming.lookup("//hostName/AlertAPI");
 }
 catch(Exception ee)
 {
    System.out.println("Error in getting AlertAPI handle");
    ee.printStackTrace();
 }
 
 

For the same JVM as that of WebNMS server, NmsUtil.getAPI(String) can be used to get AlertAPI handle.


Method Summary
 boolean addAlertListener(AlertListener obs)
          This method adds the given AlertListener into WebNMS so that it will get notification while about various alert related operations perfomed in NMS.
 void addAnnotation(AlertAnnotation altHistory)
          To add AlertAnnotation object to the Alert object which is specified by the entity field of the given object.
 Alert checkOut(java.lang.String entity, int timeOut)
          This method checks out the Alert with the given entity from the database for writing, with a write lock.
 Alert checkOutIfAvailable(java.lang.String entity)
          This method checks out the Alert with the given entity from the database for writing, with a write lock.
 boolean checkWritePermission(Alert obj)
          Checks whether this instance of the AlertObject can be updated.
 void clearAlert(Alert alert)
          Deprecated. This method has been deprecated as of WebNMS2.2. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use clearAlert(Alert alert,boolean dealWithLock) to clear that Alert. Use unlock(Alert alt) to unlock the checked out object.
 void clearAlert(Alert alert, boolean dealWithLock)
          Clears the alert.
 void clearAlert(java.lang.String entity)
          Deprecated. Deprecated as of WebNMS2.3 Because complete Alert object is needed to lock that object during this operation. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use clearAlert(Alert entity,boolean dealWithLock) to clear that Alert. Use unlock(Alert alt) to unlock the checked out object.
 void clearLockForObject(java.lang.String entity, int lockType)
          Releases the specified lock type unconditionally for the AlertObject with the given entity.
 void deleteAlert(Alert alert, boolean dealWithLock)
          Deletes given alert from WebNMS.
 void deleteAlert(java.lang.String entity)
          Deprecated. Deprecated as of WebNMS2.3. Because complete Alert object is needed to lock that object during this operation. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use deleteAlert(Alert entity,boolean dealWithLock) to delete that Alert.
 void deleteAlertAnnotation(java.lang.String entity)
          To delete all AlertAnnotation objects for an Alert Object which is specified by the given entity.
 void deleteAlertHistory(java.lang.String entity)
          To delete all AlertHistory for an Alert Object which is specified by the given entity.
 Alert getAlert(java.lang.String entity)
          Deprecated. as of WebNMS2.3. Use checkOutIfAvailable(String entity) to get locked Alert object with the specified entity. Use unlock(Alert alt) to unlock the checked out object.
 int getAlertCount(java.lang.String[] category, int severity)
          Returns the number of alerts with the specified array of categories and severity.
 int getAlertCount(java.lang.String category, int severity)
          Returns the number of alerts in WebNMS with the given category and severity
 java.util.Properties getAlertModuleParams()
          Gets the Alert Module parameters and their values in java.util.Properties object.
 int getAlertQueueSize()
          No of events in the queue which need to be processed as Alerts.
 java.util.Vector getAlerts(Alert alert)
          Deprecated. This method has been deprecated as of WebNMS2.0
 java.util.Vector getAlerts(Alert alert1, Alert alert2)
          This will get all alerts matching the properties in the first parameter alert1 Alert object and between the time specified in the first and second parameter alert2 Alert object.
 java.util.Vector getAlertsBasedOnGroupViewMode()
          For internal use only.
 int getAlertsCount(int severity)
          Returns the number of alerts with given severity in the WebNMS System.
 java.util.Vector getAnnotation(java.lang.String entity)
          This method gets the complete set of AlertAnnotation Objects in a Vector for a particular Alert which is specified by the given entity.
 int getCurrentLockType(Alert obj)
          Get the lock type currently held by the specified instance of the AlertObject.
 java.lang.String getGroupViewMode()
          Returns the value of the parameter GROUP_VIEW_MODE which is the command line argument for EventMgr process which can either be max ,latest or none.
 java.util.Vector getHistory(java.lang.String entity)
          This method gets the complete set of AlertHistory Objects in a Vector for a particular Alert which is specified by the given entity.
 int getMaxSeverityofAlerts()
          This method returns the associated integer value of the maximum severity alert that is pending(or present) in the Web NMS system.
 java.util.Vector getNextAlertBasedOnGroupViewMode(java.lang.String groupName)
          For internal use only.
 Alert getNextAlertBasedOnModtime(java.lang.String entity)
          This method returns the Alert generated or modified, next to the Alert whose 'entity' field is passed as a parameter.
 java.util.Vector getObjectPropsWithProps(java.lang.String classname, java.lang.String[] fetchProperties, java.util.Properties criteria, boolean returnAsProps)
          Gets a Vector containing selective properties of objects matching the given criteria.
 java.util.Vector getObjects(java.lang.String classname, java.util.Properties match)
          Returns a vector of alert objects that belong to the specified classname.
 Alert getOldestModifiedAlert()
          This method returns oldest modified Alert.
 int getTotalAlertCount()
          Returns Total number of Alerts in the WebNMS system.
 int getTotalAlertCount(java.lang.String category)
          Returns the total number of alerts with the specified category
 int getTotalAlertCount(java.lang.String[] category)
          Returns the total number of alerts with the specified array of categories
 Alert lock(Alert obj, int lock_type, int timeout)
          This method will lock the specified Alert, by applying the given type of lock, which will actually define access levels for the object.
 void pauseFilterAction(java.lang.String[] runnableClassName)
          This method can be used to pause the filter action thread at runtime which is running.
 void pickUpAlert(Alert alert, java.lang.String who)
          Deprecated. This method has been deprecated as of WebNMS2.2. Users are suggested to use checkOutIfAvailable(String) to get the Alert object and after getting Alert object use pickUpAlert(Alert,String,boolean) to pickup that Alert. Use unlock(Alert alt) to unlock the checked out object.
 void pickUpAlert(Alert alert, java.lang.String who, boolean dealWithLock)
          Picks up an alert.
 void pickUpAlert(java.lang.String entity, java.lang.String who)
          Deprecated. Deprecated as of WebNMS2.3. Because complete Alert object is needed to lock that object during this operation. Users are suggested to use checkOutIfAvailable(String) to get the Alert object and after getting Alert object use pickUpAlert(Alert,String,boolean) to pickup that Alert. Use unlock(Alert alt) to unlock the checked out object.
 void purgeAlertDB()
          Deletes all the alerts in the WebNMS.
 boolean removeAlertListener(AlertListener obs)
          To remove the AlertListener that has been already added by the previous method.
 void resumeFilterAction(java.lang.String[] runnableClassName)
          This method can be used to resume the filter action thread at runtime which has been paused.
 void setAlertModuleParams(java.util.Properties prop)
          Sets the Alert Module Parameters.
 void unlock(Alert obj)
          Unlock the specified AlertObject.
 void unPickAlert(Alert alert, java.lang.String who, boolean dealWithLock)
          This method unpicks the alert, if it is already picked up by an user.
 void unPickAlert(java.lang.String entity, java.lang.String who)
          Deprecated. Deprecated as of WebNMS2.3. Because complete Alert object is needed to lock that object during this operation. Users are suggested to use checkOutIfAvailable(String) to get the Alert object and after getting Alert object use unPickAlert(Alert,String,boolean) to unpick that Alert. Use unlock(Alert alt) to unlock the checked out object.
 boolean updateAlert(Alert alert)
          Updates the Alert, matching the entity as that of the alert passed as a parameter to the method.
 boolean updateAlert(Alert alert, boolean dealWithLock)
          Updates the Alert, matching the entity as that of the alert passed as a parameter to the method.
 void updateNotes(Alert alert, java.lang.String notes)
          Deprecated. This method has been deprecated as of WebNMS2.1. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use updateNotes(Alert alert,String userName,String notes,boolean dealWithLock) to add annotation to that Alert.
 void updateNotes(Alert alert, java.lang.String userName, java.lang.String notes)
          Deprecated. This method has been deprecated as of WebNMS2.1. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use updateNotes(Alert alert,String userName,String notes,boolean dealWithLock) to add annotation to that Alert. Use unlock(Alert alt) to unlock the checked out object.
 void updateNotes(Alert alert, java.lang.String userName, java.lang.String notes, boolean dealWithLock)
          To add annotation notes to the Alert.
 void updateNotes(java.lang.String entity, java.lang.String notes)
          Deprecated. This method has been deprecated as of WebNMS2.2. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use updateNotes(Alert alert,String userName,String notes,boolean dealWithLock) to add annotation to that Alert. Use unlock(Alert alt) to unlock the checked out object.
 void updateNotes(java.lang.String entity, java.lang.String userName, java.lang.String notes)
          Deprecated. Deprecated as of WebNMS2.3, Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use updateNotes(Alert alert,String userName,String notes,boolean dealWithLock) to add annotation to that Alert. Use unlock(Alert alt) to unlock the checked out object.
 
Methods inherited from interface com.adventnet.nms.util.CommonAPI
getCompleteList, getObjectNamesWithProps, getPropertiesOfObject
 

Method Detail

pickUpAlert

void pickUpAlert(Alert alert,
                 java.lang.String who)
                 throws java.rmi.RemoteException
Deprecated. This method has been deprecated as of WebNMS2.2. Users are suggested to use checkOutIfAvailable(String) to get the Alert object and after getting Alert object use pickUpAlert(Alert,String,boolean) to pickup that Alert. Use unlock(Alert alt) to unlock the checked out object.

Picks up an alert. The person who is picking up the Alert is responsible to solve the root cause of the Alert. While picking up an Alert, 'who' field of that Alert object is assigned to the name of the user, who is picking up. This method does nothing while the specified Alert is already picked up. An AlertAnnotation entry will be added for the user who is picking up. During this operation who field of Alert object alone changes.

Parameters:
alert - The Alert Object to be picked up.
who - name of the user who is picking up the Alert
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
pickUpAlert(Alert alt,String user,boolean dealWithLock)

pickUpAlert

void pickUpAlert(Alert alert,
                 java.lang.String who,
                 boolean dealWithLock)
                 throws java.rmi.RemoteException,
                        AccessDeniedException,
                        UserTransactionException,
                        FaultException
Picks up an alert. The corresponding Alert will be assigned to the person who is picking up the Alert. While picking up an Alert, 'who' field of that Alert object is assigned to the name of the user, who is picking up. An AlertAnnotation entry will be added for the user who is picking up. This method does nothing while the specified Alert is already picked up. During this operation who field of Alert object alone changes. Alert observers and Alert Listerners will be notified about this operation.

To avoid data inconsistency the user is recommended to get the locked alert object using checkOutIfAvailable(String entity) method and then set the value of boolean dealWithLock as 'true'. After required action is performed, user has to unlock the Alert Object by unlock(Alert obj).

Note : FaultException will not be thrown when there is some problem while adding Alert annotation entry into ANNOTATION table.

Parameters:
alert - The Alert Object to be picked up.
who - name of the user who is picking up the Alert
dealWithLock - provides concurrency control for the Alert Object which is passed as one of the arguments of this method. When the parameter ALERT_LOCK is set to 'true' and this boolean is set as 'true', then this pick up operation over the Alert object passed as a parameter will be thread safe.
Throws:
java.rmi.RemoteException - if request fails in remote machine
AccessDeniedException - if the object is already locked by some other thread and is not available for writing.
UserTransactionException - if there is any exception while making the transaction
FaultException - wrapper for all other module level exceptions
See Also:
unPickAlert(Alert alert,String who,boolean dealWithLock)

pickUpAlert

void pickUpAlert(java.lang.String entity,
                 java.lang.String who)
                 throws java.rmi.RemoteException
Deprecated. Deprecated as of WebNMS2.3. Because complete Alert object is needed to lock that object during this operation. Users are suggested to use checkOutIfAvailable(String) to get the Alert object and after getting Alert object use pickUpAlert(Alert,String,boolean) to pickup that Alert. Use unlock(Alert alt) to unlock the checked out object.

Picks up an alert. While picking up an Alert, 'who' field of that Alert object is assigned to the name of the user, who is picking up. An AlertAnnotation entry will be added for the user who is picking up. This method does nothing while the specified Alert is already picked up. During this operation who field of Alert object alone changes.

Parameters:
entity - The 'entity' field of the Alert object to be picked up.
who - name of the user who is picking up the Alert
Throws:
java.rmi.RemoteException - if error occurs in Remote machine
See Also:
pickUpAlert(Alert alt,String who,boolean dealWithLock)

unPickAlert

void unPickAlert(java.lang.String entity,
                 java.lang.String who)
                 throws java.rmi.RemoteException
Deprecated. Deprecated as of WebNMS2.3. Because complete Alert object is needed to lock that object during this operation. Users are suggested to use checkOutIfAvailable(String) to get the Alert object and after getting Alert object use unPickAlert(Alert,String,boolean) to unpick that Alert. Use unlock(Alert alt) to unlock the checked out object.

This method unpicks the alert, whose entity field matches entity,if it is already picked up by an user. This method does nothing if the Alert is already unpicked/not yet picked up. An AlertAnnotation entry will be entered for the user who unpicks the alert. During this operation who field of Alert object alone changes.

Parameters:
entity - The entity of the Alert object to be picked up.
who - The user name who unpicks the alert
Throws:
java.rmi.RemoteException
See Also:
unPickAlert(Alert alert,String who,boolean dealWithLock)

unPickAlert

void unPickAlert(Alert alert,
                 java.lang.String who,
                 boolean dealWithLock)
                 throws java.rmi.RemoteException,
                        AccessDeniedException,
                        UserTransactionException,
                        FaultException
This method unpicks the alert, if it is already picked up by an user. An AlertAnnotation entry will be entered for user who unpicked the alert. This method does nothing if the Alert is already unpicked/not yet picked up. During this operation who field of Alert object alone changes. Alert observers and Alert Listerners will be notified about this operation.

To avoid data inconsistency the user is recommended to get the locked alert object using checkOutIfAvailable(String entity) method and then set the value of boolean dealWithLock as 'true'. After required action is performed, user has to unlock the Alert Object by unlock(Alert obj).

Note : FaultException will not be thrown when there is some problem while adding Alert annotation entry into ANNOTATION table.

Parameters:
alert - The Alert object to be picked up.
who - The user name who unpicking the alert
dealWithLock - provides concurrency control for the Alert Object passed as one of the argument here. When the parameter ALERT_LOCK is set to 'true' and this boolean is set as 'true', then this unpick up operation over the Alert object passed as a parameter will be thread safe.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if there is any exception while making the transaction
FaultException - wrapper for all other module level exceptions
See Also:
pickUpAlert(Alert alert,String who,boolean dealWithLock)

getAlert

Alert getAlert(java.lang.String entity)
               throws java.rmi.RemoteException
Deprecated. as of WebNMS2.3. Use checkOutIfAvailable(String entity) to get locked Alert object with the specified entity. Use unlock(Alert alt) to unlock the checked out object.

This method gets the Alert Object whose entity field matches with the given entity.

Parameters:
entity - Entity field of the Alert Object to be obtained
Returns:
The Alert Object whose entity field matches the parameter entity. 'null' will be returned, if no Alert object with entity field matching the parameter entity is available or the given argument is 'null'
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
checkOutIfAvailable(String entity), checkOut(String entity,int timeOut)

getAlerts

java.util.Vector getAlerts(Alert alert)
                           throws java.rmi.RemoteException,
                                  FaultException
Deprecated. This method has been deprecated as of WebNMS2.0

Get all alerts matching the criteria specified in the parameter alert Values can also be set to the user properties of the Alert for which matching should be done in the parameter alert.

The values set for the String based properties in parameter alert can take wildCard character * which stands for its well known purpose. The String based properties can also accept values that starts with character ! which stands for negation operation while matching. They can also accept ,(comma) seperated values which can match any one of the values seperated by comma.

      Example criteria for String based properties:
               
                  1. WebNMS*  - matches values startswith WebNMS
                  2. *WebNMS  - matches values endswith WebNMS
                  3. !WebNMS  - matches values that does not start with WebNMS
                  4. Node,Interface,Snmp  - matches any value that startwith 
                       any of the mentioned string                 
 

The values set for Numeric properties can only match the exact value given for the property in Alert object passed namely alert. For the properties modTime and createTime, this method will return all the Alerts whose modTime or createTime is greater than that of the given Alert's modTime or createTime respectively.

Parameters:
alert - The alert object whose properties are used for filtering alerts.
Returns:
A Vector of Alerts matching the given critieria, returns all alerts if input alert is null and returns null if no alerts are matching for the properties of the given Alert.
Throws:
java.rmi.RemoteException - in request fails in remtoe machine
FaultException - will be thrown for any error in transaction and for any SQL error
See Also:
getAlerts(Alert alert1,Alert alert2), CommonAPI.getObjectNamesWithProps(Properties), CommonAPI.getPropertiesOfObject(String), CommonAPI.getCompleteList()

getAlerts

java.util.Vector getAlerts(Alert alert1,
                           Alert alert2)
                           throws java.rmi.RemoteException,
                                  FaultException
This will get all alerts matching the properties in the first parameter alert1 Alert object and between the time specified in the first and second parameter alert2 Alert object. Values can also be set to the user properties of the Alert for which, matching should be done in the parameter alert1.

The values set for the String based properties in first Alert can take wildCard character * which stands for its well known purpose. The String based properties can a also accept values that starts with character ! which stands for negation operation while matching. They can also accept ,(comma) seperated values which can match any one of the values seperated by comma.

      Example criteria for String based properties:
               
                  1. WebNMS*  - matches values startswith WebNMS
                  2. *WebNMS  - matches values endswith WebNMS
                  3. !WebNMS  - matches values that does not start with WebNMS
                  4. Node,Interface,Snmp  - matches any value that startwith any of 
                      the mentioned string                 
 

The values set for Numeric properties can only match the exact value given for the property in alert object passed, namely alert1.

For the properties modTime and createTime the matching would take place as follows.

     1. modTime specified both in alert1 and alert2. 
         Matches the Alert whose modTime greater than that specified in alert1
          and less than specifed in alert2
     2. modTime specified only in alert1 and not in alert2:
          Matches the Alert whose modTime greater than specifed in alert1
     3.  modTime specified only in alert2 and not in alert1:
           Matches the Alert whose modTime less than specified in alert2
     4.  modTime not specified in both alert2 and alert1:
           modTime will not be taken as a filtering criteria
 
     The same matching mechanism will be followed for the property createTime 
 

Parameters:
alert1 - The Alert object whose properties are used for filtering events. The time field indicates filtering all Alerts whose time is after the time indicated in this Alert.
alert2 - The time field indicates filtering all alerts whose time is before the time indicated in this Alert.
Returns:
A Vector of Alerts matching the given critieria. Returns all the alerts if alert1 is null and returns 'null' while no Alerts are there in WebNMS with the specified properties.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there is any exception while fetching the alerts
FaultException - will be thrown for any error in transaction and for any SQL error matching the properties
See Also:
CommonAPI.getObjectNamesWithProps(Properties), CommonAPI.getPropertiesOfObject(String), CommonAPI.getCompleteList()

deleteAlert

void deleteAlert(Alert alert,
                 boolean dealWithLock)
                 throws java.rmi.RemoteException,
                        AccessDeniedException,
                        UserTransactionException,
                        FaultException
Deletes given alert from WebNMS. Corresponding Annotation and History objects are deleted based on the value of ON_DELETING_ALERT_DELETE parameter against EventMgr process in NmsProcessesBE.conf file. This parameter can have any of the following values.
 
 none
 history
 annotation
 both
 
 

If ON_DELETING_ALERT_DELETE is set to none, both history and annotation will not be deleted while deleting Alert. If it is set to annotation, only annotation will be deleted while deleting Alert. It it is set to history, only history will be deleted. Both history and annotation will be deleted if the parameter is is set to both Alert observers and Alert Listerners will be notified about this operation.

If the Alert is deleted, corresponding Managed Object will be updated based on ALERT_TO_MANAGEDOBJECT_PROPOGATION parameter against EventMgr process in NmsProcessesBE.conf file, this parameter can have any one of the following values

 
 max
 latest
 none
 
If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to none, Managed Object will not be updated by Alerts. If it is set to max, Managed Object will reflect the maximum severity of Alerts belongs to that Manged Object. If the Alert belongs to that Managed Object is deleted, then that Managed object will be updated by the maximum severity of the remaining Alerts. If there is no more Alerts for that Managed Object, then it will reflect clear status. If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to latest, Managed Object will reflect the status of latest Alert belongs to that Managed Object.

To delete the Alert after locking the Alert object, user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.

Note: Unlike other operations, there is no need to unlock the Alert object after the delete operation is completed. Once the Alert is deleted from database, corresponding lock will be removed by WebNMS automatically.

Note : FaultException will not be thrown when there is some problem while adding Alert history entry into ANNOTATION table.

Parameters:
alert - The Alert object to be deleted
dealWithLock - provides concurrency control for the Alert Object passed as an argument.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if there is any exception while making the transaction
FaultException - wrapper for all other module level exceptions

deleteAlert

void deleteAlert(java.lang.String entity)
                 throws java.rmi.RemoteException
Deprecated. Deprecated as of WebNMS2.3. Because complete Alert object is needed to lock that object during this operation. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use deleteAlert(Alert entity,boolean dealWithLock) to delete that Alert.

Deletes the alert from WebNMS. Corresponding Annotation and History objects are deleted based on the value of ON_DELETING_ALERT_DELETE parameter against EventMgr process in NmsProcessesBE.conf file. This parameter can have any of the following values.
 
 none
 history
 annotation
 both
 
 

If ON_DELETING_ALERT_DELETE is set to none, both history and annotation won't be deleted while deleting Alert. If it is set to annotation, only annotation will be deleted while deleting Alert. It it is set to history, only history will be deleted. Both history and annotation will be deleted it the parameter is is set to both

If the Alert is deleted, corresponding Managed Object will be updated based on ALERT_TO_MANAGEDOBJECT_PROPOGATION parameter against EventMgr process in NmsProcessesBE.conf file, this parameter can have any one of the following values

 
 max
 latest
 none
 
 
If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to none, Managed Object will not be updated by Alerts. If it is set to max, Managed Object will reflect the maximum severity of Alerts belongs to that Manged Object. If the Alert belongs to that Managed Object is deleted, that will be updated by the maximum severity of the remaining Alerts. If there is no more Alerts for that Managed Object, then that Managed Object will reflect clear status. If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to latest, Managed Object will reflect the status of latest Alert belongs to that Managed Object.

Parameters:
entity - The entity of the alert object to be deleted.
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
deleteAlert(Alert alert,boolean dealWithLock)

clearAlert

void clearAlert(Alert alert)
                throws java.rmi.RemoteException
Deprecated. This method has been deprecated as of WebNMS2.2. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use clearAlert(Alert alert,boolean dealWithLock) to clear that Alert. Use unlock(Alert alt) to unlock the checked out object.

Clears the alert. Changes the severity of the alert to clear. No other fields of Alert object is changed other than severity and modTime fields of Alert. An Annotation entry for this operation will be added.

If the Alert is cleared, corresponding Managed Object will be updated based on ALERT_TO_MANAGEDOBJECT_PROPOGATION parameter against EventMgr process in NmsProcessesBE.conf file, this parameter can have any one of the following values

 
 max
 latest
 none
 
If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to none, Managed Object will not be updated by Alerts. If it is set to max, Managed Object will reflect the maximum severity of Alerts belongs to that Manged Object. If the Alert belongs to that Managed Object is cleared, that will be updated by the maximum severity of the remaining Alerts. If there is no more Alerts for that Managed Object, then it will reflect clear status. If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to latest, Managed Object will reflect the status of latest Alert belongs to that Managed Object.

Parameters:
alert - The Alert Object whose status is to be cleared.
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
clearAlert(Alert alert,boolean dealWithLock)

clearAlert

void clearAlert(Alert alert,
                boolean dealWithLock)
                throws java.rmi.RemoteException,
                       AccessDeniedException,
                       UserTransactionException,
                       FaultException
Clears the alert. Changes the severity of the alert to clear. No other fields of Alert object is changed other than severity and modTime fields of Alert. An Annotation entry for this operation will be added.

If the Alert is cleared, corresponding Managed Object will be updated based on ALERT_TO_MANAGEDOBJECT_PROPOGATION parameter against EventMgr process in NmsProcessesBE.conf file, this parameter can have any one of the following values

 
 max
 latest
 none
 
 
If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to none, Managed Object will not be updated by Alerts. If it is set to max, Managed Object will reflect the maximum severity of Alerts belongs to that Manged Object. If the Alert belongs to that Managed Object is cleared, that will be updated by the maximum severity of the remaining Alerts. If there is no more Alerts for that Managed Object, then it will reflect clear status. If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to latest, Managed Object will reflect the status of latest Alert belongs to that Managed Object. Alert observers and Alert Listerners will be notified about this operation.

To avoid data inconsistency the user is recommended to get the locked alert object using checkOutIfAvailable(String entity) method and then set the value of boolean dealWithLock as 'true'. After required action is performed, user has to unlock the Alert Object by unlock(Alert obj).

Note : FaultException will not be thrown when there is some problem while adding Alert history entry into ANNOTATION table.

Parameters:
alert - The Alert Object whose status is to be cleared.
dealWithLock - provides concurrency control for the Alert Object passed as an argument here. When the parameter ALERT_LOCK is set to 'true' and this boolean is set as 'true', then this clear operation over the Alert object passed as a parameter will be thread safe.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine.
UserTransactionException - if there is any exception while making to the transaction
FaultException - wrapper for all other module level exceptions
See Also:
pickUpAlert(Alert alert,String who,boolean dealWithLock)

clearAlert

void clearAlert(java.lang.String entity)
                throws java.rmi.RemoteException
Deprecated. Deprecated as of WebNMS2.3 Because complete Alert object is needed to lock that object during this operation. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use clearAlert(Alert entity,boolean dealWithLock) to clear that Alert. Use unlock(Alert alt) to unlock the checked out object.

Clears the alert. Changes the severity of the alert to clear. No other fields of Alert object is changed other than severity and modTime fields of Alert. An Annotation entry for this operation will be added.

If the Alert is cleared, corresponding Managed Object will be updated based on ALERT_TO_MANAGEDOBJECT_PROPOGATION parameter against EventMgr process in NmsProcessesBE.conf file, this parameter can have any one of the following values

 
 max
 latest
 none
 
 
If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to none, Managed Object will not be updated by Alerts. If it is set to max, Managed Object will reflect the maximum severity of Alerts belongs to that Manged Object. If the Alert belongs to that Managed Object is cleared, that will be updated by the maximum severity of the remaining Alerts. If there is no more Alerts for that Managed Object, then it will reflect clear status. If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to latest, Managed Object will reflect the status of latest Alert belongs to that Managed Object.

Parameters:
entity - The entity of the Alert Object whose status is to be cleared.
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
clearAlert(Alert alert,boolean dealWithLock)

updateAlert

boolean updateAlert(Alert alert)
                    throws java.rmi.RemoteException,
                           UserTransactionException,
                           FaultException
Updates the Alert, matching the entity as that of the alert passed as a parameter to the method. All the properties of the existing alert will be replaced with the properties of the alert passed as a parameter.

The user should note that the severity value of the alert object passed should not be equal to that of any NO-CRITICAL severities defined in the Web NMS system, as well as that of the Special Purpose severity defined. Similarly, the entity and the source field cannot be null, in which case the method call will fail.

The user can modify all the properties except that of PreviousSeverity(alert previous severity) and modTime(alert Modified time). The previous severity will be set from the severity of the existing alert and the modified time will be determined by the Web NMS server, which will update it with the exact time of modification.

If the Alert is updated, corresponding Managed Object will be updated based on ALERT_TO_MANAGEDOBJECT_PROPOGATION parameter against EventMgr process in NmsProcessesBE.conf file, this parameter can have any one of the following values

 
 max
 latest
 none
 
 
If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to none, Managed Object will not be updated by Alerts. If it is set to max, Managed Object will reflect the maximum severity of Alerts belongs to that Manged Object. If the Alert belongs to that Managed Object is updated, Managed Object will be updated by the maximum severity of the remaining Alerts. If there is no more Alerts for that Managed Object, then it will reflect status of the updated Alert. If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to latest, Managed Object will reflect the status of latest Alert belongs to that Managed Object.

The method will return a value true, if the updation is successfull or else false will be returned.

Note : FaultException will not be thrown when there is some problem while adding Alert history entry into ANNOTATION table.

Parameters:
alert - The alert object by which the existing alert which has same matching entity will be updated with.
Returns:
true, if the updation had been successfully done, false if no entity or source fields of the Alert object is null or no Alert is there in WebNMS with the corresponding entity
Throws:
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if there is any exception while making the transaction for update the alert
FaultException - wrapper for all other module level exceptions
See Also:
updateAlert(Alert alert,boolean dealWithLock)

updateAlert

boolean updateAlert(Alert alert,
                    boolean dealWithLock)
                    throws java.rmi.RemoteException,
                           AccessDeniedException,
                           UserTransactionException,
                           FaultException
Updates the Alert, matching the entity as that of the alert passed as a parameter to the method. All the properties of the existing alert will be replaced with the properties of the alert passed as parameter.

To avoid data inconsistency the user is recommended to get the locked alert object using checkOutIfAvailable(String entity) method and then set the value of boolean dealWithLock as 'true'. After required action is performed, user has to unlock the Alert Object by unlock(Alert obj).

The user should note that the severity value of the alert object passed should not be equal to that of any NO-CRITICAL severities defined in the Web NMS system as well as that of the Special Purpose severity defined. Similarly the entity and the source field cannot be null, in both the cases the method call will fail.

The user can modify all the properties except that of PreviousSeverity (alert previous severity) and modTime(alert Modified time). The previous severity will be set from the severity of the existing alert and the modified time will be determined by the Web NMS server, which will update it with the exact time of modification.

If the Alert is updated, corresponding Managed Object will be updated based on ALERT_TO_MANAGEDOBJECT_PROPOGATION parameter against EventMgr process in NmsProcessesBE.conf file, this parameter can have any one of the following values

 
 max
 latest
 none
 
 
If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to none, Managed Object will not be updated by Alerts. If it is set to max, Managed Object will reflect the maximum severity of Alerts belongs to that Manged Object. If the Alert belongs to that Managed Object is updated, Managed Object will be updated by the maximum severity of the remaining Alerts. If there is no more Alerts for that Managed Object, then it will reflect status of the updated Alert. If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to latest, Managed Object will reflect the status of latest Alert belongs to that Managed Object. Alert observers and Alert Listerners will be notified about this operation. The method will return a value true if the updation was successfull or else false will be returned.

Note : FaultException will not be thrown when there is some problem while adding Alert history entry into ANNOTATION table.

Parameters:
alert - The alert object with which the existing alert with the same matching entity will be updated with.
dealWithLock - provides concurrency control for the Alert Object passed as an argument. When the parameter ALERT_LOCK is set to 'true' and this boolean is set as 'true', then this update operation over the Alert object passed as a parameter will be thread safe.
Returns:
true, if the updation had been successfully done, false if no entity or source fields of the Alert object is null or no Alert is there in WebNMS with the corresponding entity
Throws:
java.rmi.RemoteException - if request fails in remote machine
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
UserTransactionException - if there is any exception while making to the transaction
FaultException - wrapper for all other module level exceptions
See Also:
clearAlert(Alert alert,boolean dealWithLock)

updateNotes

void updateNotes(Alert alert,
                 java.lang.String userName,
                 java.lang.String notes,
                 boolean dealWithLock)
                 throws java.rmi.RemoteException,
                        AccessDeniedException,
                        UserTransactionException,
                        FaultException
To add annotation notes to the Alert. If the userName is null, it will be added with user name as "Default User". notes and modTime fields of the corresponding Alert will be changed accordingly. Alert Observers and AlertListeners will be notified about this operation. To add annotation notes after locking the Alert object, the user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true. After the required action is performed the user has to unlock the Alert Object by unlock(Alert obj) method. Alert observers and Alert Listerners will be notified about this operation.

Parameters:
alert - The Alert object to which annotation has to be done.
notes - The annotation text
userName - The name of the user who is adding the annotation
dealWithLock - provides concurrency control for the Alert Object passed as an argument. When the parameter ALERT_LOCK is set to 'true' and this boolean is set as 'true', then this update notes operation over the Alert object passed as a parameter will be thread safe.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if there is any exception while making to the transaction
FaultException - wrapper for all other module level exceptions

updateNotes

void updateNotes(Alert alert,
                 java.lang.String notes)
                 throws java.rmi.RemoteException
Deprecated. This method has been deprecated as of WebNMS2.1. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use updateNotes(Alert alert,String userName,String notes,boolean dealWithLock) to add annotation to that Alert.

This will add annotation notes to the Alert. This method adds an Annotation with user name as "Default User". notes and modTime fields of the corresponding Alert will be changed accordingly.

Parameters:
alert - The Alert object to which annotation has to be done.
notes - The text which is to be used for annotation.
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
updateNotes(Alert alert,String userName,String notes,boolean dealWithLock)

updateNotes

void updateNotes(Alert alert,
                 java.lang.String userName,
                 java.lang.String notes)
                 throws java.rmi.RemoteException
Deprecated. This method has been deprecated as of WebNMS2.1. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use updateNotes(Alert alert,String userName,String notes,boolean dealWithLock) to add annotation to that Alert. Use unlock(Alert alt) to unlock the checked out object.

To add annotation notes to the Alert as annotated by user of name userName. This call would be useful for servlets in HTML UI. notes and modTime fields of the corresponding Alert will be changed accordingly.

Parameters:
alert - The Alert object to which annotation has to be done.
userName - The name of the user who is adding the annotation
notes - The text which is to be used for annotation.
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
updateNotes(Alert alert,String userName,String notes,boolean dealWithLock)

updateNotes

void updateNotes(java.lang.String entity,
                 java.lang.String notes)
                 throws java.rmi.RemoteException
Deprecated. This method has been deprecated as of WebNMS2.2. Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use updateNotes(Alert alert,String userName,String notes,boolean dealWithLock) to add annotation to that Alert. Use unlock(Alert alt) to unlock the checked out object.

To add annotation notes to the Alert. If the userName is not given, it will be added with user name as "Default User". notes and modTime fields of the corresponding Alert will be changed accordingly.

Parameters:
entity - The entity of the Alert to which annotation has to be done.
notes - The text which is to be used for annotation.
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
updateNotes(Alert alert,String userName,String notes,boolean dealWithLock)

updateNotes

void updateNotes(java.lang.String entity,
                 java.lang.String userName,
                 java.lang.String notes)
                 throws java.rmi.RemoteException
Deprecated. Deprecated as of WebNMS2.3, Users are suggested to use checkOutIfAvailable(String entity) to get the Alert object and after getting Alert object use updateNotes(Alert alert,String userName,String notes,boolean dealWithLock) to add annotation to that Alert. Use unlock(Alert alt) to unlock the checked out object.

This will add annotation notes to the Alert, as annotated by user of name userName. This call would be useful for servlets in HTML UI. notes and modTime fields of the corresponding Alert will be changed accordingly.

Parameters:
entity - The entity of the Alert to which annotation has to be done.
userName - The name of the user who is adding the annotation
notes - The text which is to be used for annotation.
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
updateNotes(Alert alert,String userName,String notes,boolean dealWithLock)

getMaxSeverityofAlerts

int getMaxSeverityofAlerts()
                           throws java.rmi.RemoteException
This method returns the associated integer value of the maximum severity alert that is pending(or present) in the Web NMS system.

Returns:
The severity of the Alert which is having the maximum severity among the Alerts which are pending in WebNMS at that time.
Throws:
java.rmi.RemoteException - When the api call fails via RMI.
See Also:
getTotalAlertCount(), getAlertCount(String category,int severity), getAlertCount(String category[],int severity)

getAlertsCount

int getAlertsCount(int severity)
                   throws java.rmi.RemoteException
Returns the number of alerts with given severity in the WebNMS System.

Parameters:
severity - The severity value of the alert as specified in the SeverityInfo.conf file in the WebNMS/conf directory..
Returns:
Number of Alerts with the given severity
Throws:
java.rmi.RemoteException - when this API call fails via RMI
See Also:
getTotalAlertCount(), getAlertCount(String category,int severity), getAlertCount(String category[],int severity)

getObjects

java.util.Vector getObjects(java.lang.String classname,
                            java.util.Properties match)
                            throws java.rmi.RemoteException,
                                   FaultException
Returns a vector of alert objects that belong to the specified classname. Note that if you specify properties matching extended alerts, then you should specify the extended alert classname as the first argument. The complete Alert object (along with the extended properties) will be returned. If you specify base classname (Alert) for properties matching extended alerts, getObjects will return NULL.

Parameters:
classname - Name of the class to which the object belongs
match - The matching criteria in the form of Properties
Returns:
Vector of objects matching the given properties
Throws:
java.rmi.RemoteException - if API call fails via RMI
FaultException - if there is any exception while fetching the objects with given criteria
See Also:
CommonAPI.getObjectNamesWithProps(Properties), CommonAPI.getPropertiesOfObject(String)

getGroupViewMode

java.lang.String getGroupViewMode()
                                  throws java.rmi.RemoteException
Returns the value of the parameter GROUP_VIEW_MODE which is the command line argument for EventMgr process which can either be max ,latest or none. Alert objects can be grouped based on the "groupName" field of the Alert object. Alerts with the same group name will form a group under this mechanism. When there is more than one alert in a group, one among them will represent that group. This is based on the value of the parameter GROUP_ALERTS_MODE of com.adventnet.nms.eventdb.EventMgr module in the configuration file named NmsProcessesBE.conf present in WebNMS/conf directory.

This can be either "max","latest" or "none". If the group mode is "none", then the alerts are not grouped and all the alerts are shown separately.

If the group mode is "max", then the alert of maximum severity, out of all the alerts belonging to that group, represents that group.

If the group mode is "latest", then the latest alert from an alert group represents that group.

This method will return the group view mode set in the configuration file NmsProcessesBE as mentioned above.

This GROUP_VIEW_MODE parameter has no effect in server side. In client, Alerts are shown based on the value of this parameter.

Returns:
One of the three values : "max", "latest" or "none".
Throws:
java.rmi.RemoteException - if request fails in remote machine

getAlertsBasedOnGroupViewMode

java.util.Vector getAlertsBasedOnGroupViewMode()
                                               throws java.rmi.RemoteException,
                                                      FaultException
For internal use only. Users are suggested not to use this method. Used by the AlertCustomView in FE

Returns:
Vector which contains internal informations
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching alerts based on group view mode

getNextAlertBasedOnGroupViewMode

java.util.Vector getNextAlertBasedOnGroupViewMode(java.lang.String groupName)
                                                  throws java.rmi.RemoteException,
                                                         FaultException
For internal use only. Users are suggested not to use this method. Used by the AlertCustomView in FE.

Parameters:
groupName - The groupName field of Alert object
Returns:
Vector which contains internal informations
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching next alert based on group view mode

getTotalAlertCount

int getTotalAlertCount()
                       throws java.rmi.RemoteException,
                              FaultException
Returns Total number of Alerts in the WebNMS system.

Returns:
The total number of Alerts in WebNMS
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching total alerts count
See Also:
getAlertCount(String category,int severity), getAlertCount(String category[],int severity)

getAlertQueueSize

int getAlertQueueSize()
                      throws java.rmi.RemoteException
No of events in the queue which need to be processed as Alerts. The events processed by the event module are sent to the alert module for processing into alerts. This returns the number of events in the queue in alert module which are waiting to get processed.

Returns:
The number of events waiting in the alert module to get processed.
Throws:
java.rmi.RemoteException - if request fails in remote machine

getAnnotation

java.util.Vector getAnnotation(java.lang.String entity)
                               throws java.rmi.RemoteException,
                                      FaultException
This method gets the complete set of AlertAnnotation Objects in a Vector for a particular Alert which is specified by the given entity. The Vector will be arranged according to Annotation Object's modTime in ascending order.

Parameters:
entity - The unique entity name of the Alert.
Returns:
The Vector of AlertAnnotation objects. If the Annotation Object does not exist, returns null. If there is no Alert with the given entity, this method returns 'null'.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there is any exception while getting the annotation details
See Also:
AlertAnnotation, getHistory(String entity)

getHistory

java.util.Vector getHistory(java.lang.String entity)
                            throws java.rmi.RemoteException,
                                   FaultException
This method gets the complete set of AlertHistory Objects in a Vector for a particular Alert which is specified by the given entity. The Vector will be arranged according to History Object's modTime in ascending order. If there is no AlertHistory Object for that entity, this method will return null.

Parameters:
entity - The unique entity name of the Alert.
Returns:
The Vector of AlertHistory object. If the History Object does not exist, returns null.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there is any exception while getting the history
See Also:
AlertHistory, getAnnotation(String entity)

addAnnotation

void addAnnotation(AlertAnnotation altHistory)
                   throws java.rmi.RemoteException,
                          UserTransactionException,
                          FaultException
To add AlertAnnotation object to the Alert object which is specified by the entity field of the given object. Alert and AlertAnnotation objects are linked by entity field which presents in both objects. WebNMS automatically sets the modTime to current time in milliseconds. Hence usage of AlertHistory.setModTime(long) should be avoided here. Since History object is allowed to be added only by NMS, there is no such method for AlertHistory.

Parameters:
altHistory - Annotation which has to be added.
Throws:
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if there is any exception while making the transaction
FaultException - if there is any exception while adding to the annotation
See Also:
getAnnotation(String entity), AlertAnnotation, AlertHistory

purgeAlertDB

void purgeAlertDB()
                  throws java.rmi.RemoteException,
                         NmsStorageException,
                         UserTransactionException
Deletes all the alerts in the WebNMS. All the Alerts will be deleted from database including extended Alert's tables. Corresponding Annotation and History objects are deleted based on the value of ON_DELETING_ALERT_DELETE. parameter against EventMgr process in NmsProcessesBE.conf file. This parameter can have any of the following values.
 
 none
 history
 annotation
 both
 
 

If ON_DELETING_ALERT_DELETE is set to none, both history and annotation won't be deleted while deleting Alert. If it is set to annotation, only annotation will be deleted while deleting Alert. It it is set to history, only history will be deleted. Both history and annotation will be deleted it the parameter is is set to both. Before deleting Alerts, Alert Listeners will be notified about this operation.

Note: If Alerts are deleted through this method, ManagedObjects will not be updated.

Throws:
java.rmi.RemoteException - if request fails in remote machine
NmsStorageException - if any error occurs while updating the storage.
UserTransactionException - if there is any exception while making the transaction
See Also:
deleteAlert(Alert alert,boolean dealWithLock)

getNextAlertBasedOnModtime

Alert getNextAlertBasedOnModtime(java.lang.String entity)
                                 throws java.rmi.RemoteException,
                                        FaultException
This method returns the Alert generated or modified, next to the Alert whose 'entity' field is passed as a parameter. Returns 'null', if no Alert object exists after the Alert whose 'entity' field is passed. Also returns 'null', if the Alert whose 'entity' field is passed, does not exist in the Server.

Parameters:
entity - The entity field of Alert Object
Returns:
Alert object which is next to the Alert specified by its entity based on modTime or currentTime whichever is applicable
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching next alert based on modified time
See Also:
getOldestModifiedAlert()

deleteAlertAnnotation

void deleteAlertAnnotation(java.lang.String entity)
                           throws java.rmi.RemoteException,
                                  FaultException,
                                  UserTransactionException
To delete all AlertAnnotation objects for an Alert Object which is specified by the given entity. Deleting all Alert annotation of an Alert object, causes no effect in the fields of Alert object.

Parameters:
entity - The entity field of Alert Object whose annotation needs to be deleted
Throws:
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if there is any exception while making the transaction
FaultException - if there is any exception while deleting the alert Annotation
See Also:
getAnnotation(String entity), deleteAlertHistory(String entity)

deleteAlertHistory

void deleteAlertHistory(java.lang.String entity)
                        throws java.rmi.RemoteException,
                               FaultException,
                               UserTransactionException
To delete all AlertHistory for an Alert Object which is specified by the given entity. Deleting all Alert history of an Alert object, causes no effect in the fields of the corresponding Alert object.

Parameters:
entity - The entity field of Alert object whose History needs to be deleted.
Throws:
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if there is any exception while making the transaction
FaultException - if there is any exception while deleting the alert history
See Also:
getAnnotation(String entity), deleteAlertAnnotation(String entity)

getOldestModifiedAlert

Alert getOldestModifiedAlert()
                             throws java.rmi.RemoteException,
                                    NmsStorageException
This method returns oldest modified Alert. i.e this method returns the Alert which is having the lowest modTime value.

Returns:
Alert object that has been modified least recently, 'null' if there is no Alert in WebNMS.
Throws:
java.rmi.RemoteException - if request fails in remote machine
NmsStorageException - When problem occurs getting the oldest modified Alert
See Also:
getNextAlertBasedOnModtime(String entity)

addAlertListener

boolean addAlertListener(AlertListener obs)
                         throws java.rmi.RemoteException
This method adds the given AlertListener into WebNMS so that it will get notification while about various alert related operations perfomed in NMS. When a group of Managed Objects are deleted using the TopoAPI.deleteObjectAndSubElements(String objkey) method, the corresponding alerts also get deleted. As this deletion can not be notified individually for each and every alert, a single notification will be given with the necessary details for the users to handle the condition. To receive notification when such bulk delete of Alert occurs, user written code has to implement AlertListener interface and instance of the user written class should register to WebNMS by this method. Also these listeners will be notified whenever alert related operations like clear,delete,pickup,unpick and update are performed in WebNMS

Parameters:
obs - The user written class that implements AlertListener
Returns:
true on successfull addition of AlertListener, false otherwise. Returns false while the given object is 'null'
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
AlertListener, AlertActionInformer, removeAlertListener(AlertListener)

removeAlertListener

boolean removeAlertListener(AlertListener obs)
                            throws java.rmi.RemoteException
To remove the AlertListener that has been already added by the previous method. Once the situation arises like, there after no need of getting notification about the various operations performed in Alert object, and about bulk delete operation, then this method can be used to remove the added AlertListener. This method requires the added AlertListener object to remove.

Parameters:
obs - The user written class that implements AlertListener
Returns:
returns true on successfully removal of AlertListener,false otherwise.
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
AlertListener, AlertActionInformer, addAlertListener(AlertListener)

getAlertCount

int getAlertCount(java.lang.String category,
                  int severity)
                  throws java.rmi.RemoteException,
                         FaultException
Returns the number of alerts in WebNMS with the given category and severity

Parameters:
category - category of the Alert
severity - The severity value of the alert as specified in the SeverityInfo.conf file in the WebNMS/conf directory..
Returns:
The number of Alerts with the specified category and severity
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException
See Also:
getTotalAlertCount(), getTotalAlertCount(String category)

getTotalAlertCount

int getTotalAlertCount(java.lang.String category)
                       throws java.rmi.RemoteException,
                              FaultException
Returns the total number of alerts with the specified category

Parameters:
category - category of the Alert
Returns:
The total number of Alerts with the specified category
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching alerts count for given category
See Also:
getTotalAlertCount(), getAlertCount(String category,int severity)

getTotalAlertCount

int getTotalAlertCount(java.lang.String[] category)
                       throws java.rmi.RemoteException,
                              FaultException
Returns the total number of alerts with the specified array of categories

Parameters:
category - category array of Alerts
Returns:
The total number of Alerts with the specified categories
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching alerts count for given categories
See Also:
getTotalAlertCount(), getTotalAlertCount(String category)

getAlertCount

int getAlertCount(java.lang.String[] category,
                  int severity)
                  throws java.rmi.RemoteException,
                         FaultException
Returns the number of alerts with the specified array of categories and severity. For example if user needs the count of all critical alerts with the particular categories(i.e specified in String array), they can use this method.

Parameters:
category - category of the Alerts
severity - The severity value of the alert as specified in the SeverityInfo.conf file in the WebNMS/conf directory..
Returns:
The number of Alerts with the specified array of categories and severity
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException
See Also:
getTotalAlertCount(String category), getAlertCount(String category,int severity)

checkOutIfAvailable

Alert checkOutIfAvailable(java.lang.String entity)
                          throws java.rmi.RemoteException,
                                 TimeoutException,
                                 FaultException
This method checks out the Alert with the given entity from the database for writing, with a write lock. This method throws an Exception if the Alert object is already locked by another thread and doesn't wait for the release of the previous lock. Users are advised to remove the lock as early as possible, since once lock is get for an object, then that Alert can't accessed by other users.

Parameters:
entity - The unique name of the Alert to be checked out
Returns:
Alert, if it is present in the database null, no Alert is present with the specified entity in the database
Throws:
java.rmi.RemoteException - if a problem occurs when accessing through RMI.
TimeoutException - if the object is locked by some other thread
FaultException - if there is any exception while checking the object status
See Also:
checkOut(String entity,int timeOut)

checkOut

Alert checkOut(java.lang.String entity,
               int timeOut)
               throws java.rmi.RemoteException,
                      TimeoutException,
                      FaultException
This method checks out the Alert with the given entity from the database for writing, with a write lock. If the Alert object to be checked out is currently locked by some other thread, this method keeps trying to check out the object for the specified time. If the Alert object becomes available for writing before the specified time, the object is fetched from the database, locked and will be given to the user. Returns null if no Alert is present with the specified entity Users are advised to remove the lock as early as possible, since once lock is get for an object, then that Alert can't accessed by other users.

Parameters:
entity - The unique name of the Alert to be checked out
timeOut - Time in seconds to wait, if the object is locked by some other thread.
Returns:
Alert Object, if it is present in the database null, if no Alert is present in database with the specified entity
Throws:
TimeoutException - if the object is not available for writing for the specified amount of time.
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there is any exception while checking the object status
See Also:
checkOutIfAvailable(String entity)

unlock

void unlock(Alert obj)
            throws java.rmi.RemoteException,
                   FaultException
Unlock the specified AlertObject. This method will unlock the given AlertObject, releiving it from all the previously applied locks.

Parameters:
obj - The Alert Object that is to be unlocked.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there is any exception while unlocking the object
See Also:
LockableObject, lock(Alert alt,int lock_type,int timeOut)

checkWritePermission

boolean checkWritePermission(Alert obj)
                             throws java.rmi.RemoteException,
                                    FaultException
Checks whether this instance of the AlertObject can be updated. This method checks whether the specified instance of the AlertObject currently holds a valid write lock, so that it can be updated.

Parameters:
obj - The AlertObject instance that is to be checked whether it has a write lock.
Returns:
true if the object holds a write lock, false otherwise.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there is any exception while checking the write permission
See Also:
LockableObject

getCurrentLockType

int getCurrentLockType(Alert obj)
                       throws java.rmi.RemoteException,
                              FaultException
Get the lock type currently held by the specified instance of the AlertObject. This method is useful in finding out what type of lock this instance of the AlertObject holds, when multiple instances hold different types of locks.

Parameters:
obj - AlertObject instance for which the lock type is to be obtained.
Returns:
The lock type value, as defined in the LockableObject interfae, currently held by the specified instance of the AlertObject. If the object instance is not locked previously, this method returns UNKNOWN_LOCK.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there is any exception while getting the current lock type.
See Also:
lock(Alert alt,int lock_type,int timeOut)

clearLockForObject

void clearLockForObject(java.lang.String entity,
                        int lockType)
                        throws java.rmi.RemoteException,
                               FaultException
Releases the specified lock type unconditionally for the AlertObject with the given entity. For example check out an Alert Object with lock. Assume that Alert object is lost, before removing the lock. Then successive lock calls for that Alert will fail. In such a case, this method can be used to unconditionally release the specified lock type by giving just the name of the AlertObject. But the effect of this method depends entirely on the implementation of the LockableObject interface.

Parameters:
entity - Name of the AlertObject to be unlocked.
lockType - Type of the lock to be unlocked.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there is any exception while releasing the specific lock type
See Also:
unlock(Alert alt)

lock

Alert lock(Alert obj,
           int lock_type,
           int timeout)
           throws java.rmi.RemoteException,
                  TimeoutException
This method will lock the specified Alert, by applying the given type of lock, which will actually define access levels for the object.

Parameters:
lock_type - Type of the lock to be locked. One of the constants present in LockableObject interface.
obj - AlertObject instance which is to be locked
timeout - Time in seconds to wait.
Returns:
The Alert with the lock set in it's lockId property.
Throws:
java.rmi.RemoteException - if request fails in remote machine
TimeoutException - if the Alert object is already locked and not available with in the spcified time interval,
See Also:
unlock(Alert alt)

setAlertModuleParams

void setAlertModuleParams(java.util.Properties prop)
                          throws java.rmi.RemoteException,
                                 InvalidParameterException
Sets the Alert Module Parameters. Fault Module parameters and their allowable values are tabulated as below. If the given value for any of the parameter is invalid, WebNMS takes the remaning all valid values and throws exception for that particular invalid value.

Alert Module Parameters Values Allowed
ALERT_DELETE_INTERVAL int > 0 (numhours)
ALERT_TO_MANAGEDOBJECT_PROPOGATION max,latest,none
ALERTS_USER_PROPERTY latest,append,none
CREATE_ALERT_HISTORY true,false
ON_DELETING_ALERT_DELETE none,both,history,annotation
ACTION_ON_DELETING_MO clear,delete,none
ANNOTATION_TABLE_SIZE int >= 0
ALERT_LOCK true,false
MAX_ALERTS_PER_BATCH int >= 0

Parameters:
prop - java.util.Properties object in which Alert Module Parameters and their values are stored
Throws:
java.rmi.RemoteException - if request fails in remote machine
InvalidParameterException - if invalid value is given for any of the Alert Module Parameter.

getAlertModuleParams

java.util.Properties getAlertModuleParams()
                                          throws java.rmi.RemoteException
Gets the Alert Module parameters and their values in java.util.Properties object. int, boolean values are also converted as String objects and stored in java.util.Properties object.

The following parameters and their values will be put in the java.util.Properties object and returned.

Alert Module Parameters Possible Values
ALERT_DELETE_INTERVAL int > 0 (numhours)
ALERT_TO_MANAGEDOBJECT_PROPOGATION max,latest,none
ALERTS_USER_PROPERTY latest,append,none
CREATE_ALERT_HISTORY true,false
ON_DELETING_ALERT_DELETE none,both,history,annotation
ACTION_ON_DELETING_MO clear,delete,none
ANNOTATION_TABLE_SIZE int >= 0
ALERT_LOCK true,false
ALERT_WINDOW_SIZE int > 0
GROUP_ALERTS_MODE max,latest,none
MAX_ALERTS_PER_BATCH int >= 0

Returns:
Alert Module Parameters stored in java.util.Properties object
Throws:
java.rmi.RemoteException - if request fails in remote machine

getObjectPropsWithProps

java.util.Vector getObjectPropsWithProps(java.lang.String classname,
                                         java.lang.String[] fetchProperties,
                                         java.util.Properties criteria,
                                         boolean returnAsProps)
                                         throws java.rmi.RemoteException,
                                                FaultException
Gets a Vector containing selective properties of objects matching the given criteria. The criteria can be a list of properties taken from properties of Alert or its derived objects. The objects will be selected if they match with any or all the properties given in the match criteria, ie., it uses the both AND or OR operator while querying the tables with the match criteria to obtain the required result. The user properties cannot be used in the match criteria or in the required properties. The classname signifies, the tables that must be considered for the selection of objects. Not all the properties of the match objects are returned. The required properties passed in the fetchProperties array will be retured as Properties object of key and value. The vector will have Properties for every match object of requested Properties alone. This will be enable shallow fetch of objects properties based on criteria.

For example, to fetch few properties say enity and id of all the alerts with severity 5 from the Alert Database, the following code snippet can be used.

 Properties criteria = new Properties();
 criteria.put("severity","5");
 String fetchProperties = {"entity","id"};
 Vector Alerts  =  api.getObjectPropsWithProps("Alert",fetchProperties,criteria,true,false);
 
Now the Alerts will Properties object for all objects match the criteria. The Properties will have 2 elements of entity and id for all the Alerts. This will be fetched from the tables which are associated with the object hierarchy of Alert. ie., it will fetch data from the table Alert or the extended object's tables.

This method returns only those objects whose classname property is the one passed to this method. If the given classname is incorrect, i.e., any of the property name given in the match criteria is not found in the properties of objects associated with the given classname, then this method will return null.

Parameters:
classname - the classname for the objects that are selected.
fetchProperties - the properties that needs to be fetched.
match - the criteria based on which the objects to be selected from the database.
returnAsProps - if true, returns a Vector of Properties objects else List of properties in order specified in fetchProperties
Returns:
a Vector of Properties object with selected properties of objects matching the given criteria. Returns 'null' when the classname is null or no matching objects found in the database
Throws:
java.rmi.RemoteException - if a problem occurs when accessing through RMI.
FaultException - if there is any exception while getting the Object for specific criteria

resumeFilterAction

void resumeFilterAction(java.lang.String[] runnableClassName)
                        throws java.rmi.RemoteException
This method can be used to resume the filter action thread at runtime which has been paused. This is applicable when the Alert Filter Action has been configured to run in separate thread on server startup. The functionality of running the event filter action in a separate thread cannot be configured and started using this method. Only already configured and running alert filter action thread which has been paused can be resumed. The default runnable(implementation) class is available to execute the SendEmail,SendTrap, and FilterCommand Action in separate thread.

Parameters:
runnableClassName - The classname with the package structure of the runnable class to be resumed.
Throws:
java.rmi.RemoteException - if a problem occurs when accessing through RMI. For eg, runnableClassName[0]="com.adventnet.nms.alertdb.SendEmailAlertAction" runnableClassName[1]="com.adventnet.nms.alertdb.SendTrapAlertAction" Note: The "FILTERACTION_FOR_ALERT_IN_THREAD" argument in EventMgr process must be set to true in NmsProcessBE.conf file to use this method.

pauseFilterAction

void pauseFilterAction(java.lang.String[] runnableClassName)
                       throws java.rmi.RemoteException
This method can be used to pause the filter action thread at runtime which is running. This is applicable when the Alert Filter Action has been configured to run in separate thread on server startup. The functionality of running the alert filter action in a separate thread cannot be configured and started using this method. The default runnable(implementation) class is available to execute the SendEmail,SendTrap, and FilterCommand Action in separate thread.

Parameters:
runnableClassName - The classname with the package structure of the runnable class to be resumed.
Throws:
java.rmi.RemoteException - if a problem occurs when accessing through RMI. For eg, runnableClassName[0]="com.adventnet.nms.alertdb.SendEmailAlertAction" runnableClassName[1]="com.adventnet.nms.alertdb.SendTrapAlertAction" Note: The "FILTERACTION_FOR_ALERT_IN_THREAD" argument in EventMgr process must be set to true in NmsProcessBE.conf file to use this method.

"WEBNMS_5 API Docs"

Copyright © 2013 ZOHO Corp., All Rights Reserved.