Sun GlassFish Enterprise Manager Monitoring Scripting Client 3.0 Installation and Quick Start Guide

ProcedureTo Generate Counter Statistics

Counter statistics typically correspond to a single event. For example, to calculate the number of received requests, only one event is required, for example, a “request received” event. Every time that a “request received” event is sent, the number of received requests is increased by 1.

  1. Declare and initialize a variable.

  2. Increase or decrease the variable each time the appropriate event is received.


Example 1–6 Generating a Counter Statistic

This example declares and initializes to zero the variable njspLoaded. Each time the callback function jspLoaded() is invoked, the value of this counter is increased by 1.

For the complete listing of the script from which this example is extracted, see Example 1–8.

var njspLoaded=0;

function jspLoaded(hostName) {
    njspLoaded = njspLoaded + 1;
    ...
}
...