Setting Alert Manager

Gauges can be set to update in real time, either programmatically or by polling the server for data. To know more about how to configure a real-time gauge, click [here] Setting Up Real-time Gauges.

Real-time gauges can be made more intuitive by setting an alert to indicate to you when a defined set of threshold data values are reached.

For example, if you are monitoring the CPU utilization on the server and want to display a warning message when it goes above 70%, you can set an alert using the Alert Manager.

An angular gauge configured to set an alert is shown below:

FusionCharts should load here..

The above example shows the server CPU utilization of akme.com. The angular gauge is configured with three color-coded bands to identify the utilization of the server. When their CPU utilization is over 70%, an alert is set to display a Warning message. The desired message is passed to the JavaScript function, showAlert().

The code snippet to set up the alert manager is as follows:

chart {
    …..
    …….
    "alerts": {
        "alert": [
            {
                // set the threshold range
                "minvalue": "0",
                "maxvalue": "50",
                // action on reaching the threshold range, JavaScript function showAlert()
                "action": "callJS",
                "param": "showAlert('Current server CPU Utilization is low');"
            }
        ]
    }
}

The container element for alert is alerts, which is a child of the chartelement. alert is an array of objects where every object defines a threshold range (alert range). One of the following actions can be specified with any alert range:

  • Call a JavaScript function

  • Show a predefined annotation

  • Play a dynamically loaded MP3 sound

The alert ranges should not overlap

An alert object contains the following attributes:

Attribute Name Description
minValue Minimum value for the alert range. For example, to define an alert for the range 0 - 50, minValue will be 0(inclusive).
maxValue Maximum value for the alert range. For example, to define an alert for the range 0-50, maxValue will be 50 (inclusive).
action Action to be taken when the value on the gauge matches an alert range. Possible values for this attribute are:
CALLJS – Calls a JavaScript function that is specified in the param attribute (explained below).
PLAYSOUND – Plays an MP3 sound (located relative to the chart location). The relative URL of MP3 file should be declared in the param attribute.
SHOWANNOTATION – Displays an annotation item or a group. The group id of the annotation is specified in param attribute. Grouping the annotation items is described in detail in the Grouping Annotations article.
param Parameter for the action, depending on the type of action:
CALLJS - takes the name of JavaScript function and its parameters
PLAYSOUND - takes the relative path of MP3 file
SHOWANNOTATION - takes the ID of the annotation items or a group

The data structure to set the alert manager is shown below:

...