OverView Index Help                                                                WebNMS Agent Toolkit C Edition 6 

countermonitor.c
Defines a monitor service designed to observe the values of a counter attributes. A counter monitor sends a threshold notification when the value of the counter reaches or exceeds a threshold known as the comparison level. The notify flag must be set to true. In addition, an offset mechanism enables particular counting intervals to be detected. If the offset value is not zero, whenever the threshold is triggered by the counter value reaching a comparison level, that comparison level is incremented by the offset value. This is regarded as taking place instantaneously, that is before the count is incremented. Thus, for each level, the threshold triggers an event notification every time the count increases by an interval equal to the offset value. If the counter can wrap around its maximum value, the modulus needs to be specified. The modulus is the value at which the counter is reset to zero. If the counter difference mode is used, the value of the derived gauge is calculated as the difference between the observed counter values for two successive observations. If this difference is negative, the value of the derived gauge is incremented by the value of the modulus. The derived gauge value (V[t]) is calculated using the following method: if (counter[t] - counter[t-GP]) is positive then V[t] = counter[t] - counter[t-GP] if (counter[t] - counter[t-GP]) is negative then V[t] = counter[t] - counter[t-GP] + MODULUS This implementation of the counter monitor requires the observed Attribute to be of the type integer (CHAR, U_CHAR INT16, U_INT16, INT32, U_INT32).
Return Type Method Summary
CHAR AddCounterMonitorNotificationListener(Vector *table, NotificationListener *listener, NotificationFilter *filter, CHAR *handback)
             It will create an listener and add it to the given table.
U_LONG CreateCounterMonitor(CounterMonitorInfo *info, NotificationListener *listener, NotificationFilter *filter, CHAR *handback)
             It will create a counter monitor with given monitor info and add it to the counter monitor table.
CounterMonitorInfo* CreateCounterMonitorInfo(ObjectName *objName, CHAR *attrbName, U_LONG thersold, U_LONG offset, U_LONG modulus, U_CHAR diffModeFlag, U_CHAR notifyFlag, U_LONG granularityPeriod, void *tableEntry, CHAR *message)
             It will create a Counter Monitor info using the given information.
Notification* CreateCounterMonitorNotification(CounterMonitorInfo *info, U_INT32 type)
             It will create Counter Monitor notification with the given information.
Monitor* GetCounterMonitor(U_LONG id)
             It will retrive the Counter Monitor corresponding to the given ID.
void InitCounterMonitor()
             Initialize the variables and data structures related to Counter Monitor Service after successful registration with Agent Server.
void PollCounterMonitorQueAndSendNotification()
             It will take each Entry in the gv_counterMonitorTable and check the GP value, if reached then it will check the observed Attribute value.
CHAR RemoveCounterMonitorNotificationListener(Vector *table, NotificationListener *listener, CHAR *handback)
             It will unregister the given listener and handback from given table.
void RemoveCounterMonitorTable()
             It will free all the resources allocated for the creation of a counter monitor table and removes all the listeners registered with it.
void SendCounterMonitorNotification(Vector *table, Notification *notif)
             It will broadcast the given Notification to all the registered listeners of the given table.
void StartCounterMonitorService()
             It will start the Counter Monitor Service.
void StopCounterMonitorService()
             It will stop the Counter Monitor Service.
   
Method Details

AddCounterMonitorNotificationListener()

CHAR AddCounterMonitorNotificationListener(Vector *table, NotificationListener *listener, NotificationFilter *filter, CHAR *handback)

It will create an listener and add it to the given table.

Arguments:
1. Table to store the give listeners (OUT)
2. Counter Monitor Notification listener (IN).
3. Filter for Counter Monitor notificaiton (IN).
4. Handback (context) of notification (IN).
Return type:
REGISTRATION_SUCCESS or REGISTRATION_FAILED.
Bugs:
null

CreateCounterMonitor()

U_LONG CreateCounterMonitor(CounterMonitorInfo *info, NotificationListener *listener, NotificationFilter *filter, CHAR *handback)

It will create a counter monitor with given monitor info and add it to the counter monitor table. It will register the given listener, filter & handback in the created counter monitor. After succesful creation it will retunr the unique idenitification for the created counter monitor otherwise FAILURE will be returned.

Arguments:
1. Created Counter Monitor info (IN).
2. Listener to the monitor (IN).
3. Filter to the monitor (IN).
4. Handback of the listener (IN).
Return type:
Created mointor number or FAILURE
Bugs:
null

CreateCounterMonitorInfo()

CounterMonitorInfo* CreateCounterMonitorInfo(ObjectName *objName, CHAR *attrbName, U_LONG thersold, U_LONG offset, U_LONG modulus, U_CHAR diffModeFlag, U_CHAR notifyFlag, U_LONG granularityPeriod, void *tableEntry, CHAR *message)

It will create a Counter Monitor info using the given information. During monitor creation it will send the following notifications to listeners if it is not possible to create monitor. OBSERVED_ATTRIBUTE_TYPE_ERROR, OBSERVED_OBJECT_ERROR and OBSERVED_ATTRIBUTE_ERROR Note: the given objectName will be stored as it is, it will not allocated inside.

Arguments:
1. Object Name (IN).
2. Attribute Name (IN).
3. Thersold value (IN).
4. Modulus value (IN).
5. Diff mode flag (IN)
6. Notify flag (IN).
7. Granularity period (IN).
8. Table Entry (Row) info if table column (IN).
9. Brief message about this String Monitor Info (IN).
Return type:
Created Counter Monitor Info or NULL.
Bugs:
null

CreateCounterMonitorNotification()

Notification* CreateCounterMonitorNotification(CounterMonitorInfo *info, U_INT32 type)

It will create Counter Monitor notification with the given information. If notification is not able to create then it will return NULL.

Arguments:
1. Counter Monitor Info (IN).
2. Type of the Notification (IN).
Return type:
Created Counter Notification or NULL.
Bugs:
null

GetCounterMonitor()

Monitor* GetCounterMonitor(U_LONG id)

It will retrive the Counter Monitor corresponding to the given ID. This method search the counter monitor table, and return the counter monitor reference if available, otherwise NULL will be returned.

Arguments:
1. ID of the counter monitor to be retrieved (IN).
Return type:
Counter Monitor or NULL.
Bugs:
null

InitCounterMonitor()

void InitCounterMonitor(void)

Initialize the variables and data structures related to Counter Monitor Service after successful registration with Agent Server.

Arguments:
Nothing.
Return type:
Nothing.
Bugs:
null

PollCounterMonitorQueAndSendNotification()

void PollCounterMonitorQueAndSendNotification()

It will take each Entry in the gv_counterMonitorTable and check the GP value, if reached then it will check the observed Attribute value. If the observed Attribute value exceeds the thersold value then it will send notification to its listeners. The possible notification types can be send are, RUNTIME_ERROR - if observed value is not of proper type. THRESHOLD_VALUE_EXCEEDED - if observed value exceeds thersold value.

Arguments:
Nothing.
Return type:
Nothing.
Bugs:
In non-MT platform monitoring in given GP may not achieve.

RemoveCounterMonitorNotificationListener()

CHAR RemoveCounterMonitorNotificationListener(Vector *table, NotificationListener *listener, CHAR *handback)

It will unregister the given listener and handback from given table.

Arguments:
1. Table from the given listener will be deleted (IN/OUT).
2. Counter Monitor notification listener (IN).
3. Counter Monitor notification filter (IN).
4. Filter for Counter Monitor notificaiton (IN).
Return type:
UNREGISTRATION_SUCCESS or UNREGISTRATION_FAILED.
Bugs:
null

RemoveCounterMonitorTable()

void RemoveCounterMonitorTable()

It will free all the resources allocated for the creation of a counter monitor table and removes all the listeners registered with it.

Arguments:
Nothing.
Return type:
Nothing.
Bugs:
null

SendCounterMonitorNotification()

void SendCounterMonitorNotification(Vector *table, Notification *notif)

It will broadcast the given Notification to all the registered listeners of the given table.

Arguments:
1. Table contains listeners (IN).
2. Notification to be sent (IN).
Return type:
Nothing.
Bugs:
null

StartCounterMonitorService().

void StartCounterMonitorService(void)

It will start the Counter Monitor Service.

Arguments:
Nothing.
Return type:
Nothing.
Bugs:
null

StopCounterMonitorService().

void StopCounterMonitorService(void)

It will stop the Counter Monitor Service.

Arguments:
Nothing.
Return type:
Nothing.
Bugs:
null


OverView Index Help                                                                WebNMS Agent Toolkit C Edition 6 

Copyright (c) 2009 ZOHO Corp. All Rights Reserved.