| This class defines a monitor MBean designed to observe the values of a
counter attribute. Counter attributes are those types whose value is always
positive or null and they can only be incremented. The counter monitor is
used to observe values of attribute whose type should be of integer i.e.
(Byte , Integer , Short , Long ).
A counter monitor sends a
MonitorNotification.THRESHOLD_VALUE_EXCEEDEDthreshold 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
|