Summary: Runtime administrative alerts - monitoring the "health state" of the system.
OverviewThe alert mechanism provides the ability to receive alerts on various problematic conditions at runtime by using the Administration and Monitoring API. The alerts give indication for the "health state" of the system.
The Administration and Monitoring API provides events and statistics on top of which 'rules' can be applied to trigger an alert when required.
These alerts provide for better supportability and easier troubleshooting. The following diagram illustrates a simple flow of events/statistics sent to the 'Alert Trigger' which checks if the state answers the condition to raise an alert or to resolve an alert. Notice that an alert may be raised multiple times until it is finally resolved. Predefined AlertsXAP is packaged with a number of predefined alerts whose thresholds are configurable. XAP does not currently allow for custom alerts defined by the user. Alerts can be either raised or resolved. For example, a CPU alert can be raised when the CPU utilization on a certain host crosses a certain threshold (say 80%) for a predefined amount of time. This alert can be resolved when the CPU utilization goes below another threshold (say 30%) for a predefined amount of time.
Static ConfigurationThe static configuration for the predefined alerts mentioned above is defined in the <GigaSpaces Root>/config/alerts/alerts.xml file. It includes the default settings for each alert. For example, the following is a snippet that represents the configuration of the CPU Utilization Alert. ... <alert class="org.openspaces.admin.alert.config.CpuUtilizationAlertConfiguration" enabled="true"> <property key="high-threshold-perc" value="80" /> <property key="low-threshold-perc" value="60" /> <property key="measurement-period-milliseconds" value="60000" /> </alert> ... The class attribute above is the implementation class used to configure the settings of this alert. When configuring enabled="false" alerts of this type will not be triggered, until enabled again (at runtime, see below). Note that some alert triggers define that an alert is raised each time a certain high threshold is crossed for example. This means that can be are multiple raised alerts at the same time, each indicating its own utilization reading at the time it was triggered. On the other hand, there can only be one resolving alert, which 'resolves' the already raised alert/s. Since GigaSpaces XAP is working in a distributed environment, an alert is identified with a specific component (machine, JVM, Space, etc., see below for more details) Viewing Alerts (Web-UI)
The alerts are grouped together by their 'type' (e.g. CPU, Memory, GC, etc.). When an alert is raised, it is aggregated with other consecutive alerts of the same 'type'. Previous alerts form the aggregation get "pushed" down (circled in red). A resolved alert "closes" the aggregation (circled in green). A new alert of the same 'type' will "open" a new aggregation. Sort the 'status' column in ascending order to show latest unresolved alerts. Listening for AlertsAlerts can be consumed using a registered event listener by registereing with the AlertManager component (which is part of the Administration and Monitoring API. The listener will be notified of alerts that have been triggered. Javadoc ref: Alert AlertManager XmlAlertConfigurationParser AlertTriggeredEventListener Admin admin = new AdminFactory().createAdmin(); AlertManager alertManager = admin.getAlertManager(); alertManager.configure(new XmlAlertConfigurationParser("alerts.xml").parse()); alertManager.getAlertTriggered().add(new AlertTriggeredEventListener() { public void alertTriggered(Alert alert) { System.out.println(alert); } });
The default parser parses the XML file. If needed, you can implement a different parser (see interface). The Alert EventThe org.openspaces.admin.alert.Alert instance includes the following set of properties:
Javadoc ref: AlertSeverity AlertStatus Runtime ConfigurationThe static alert configurations are parsed using the XmlAlertConfigurationParser. This pre-configures the alert manager with all the alerts found in the alerts.xml. Admin admin = new AdminFactory().createAdmin(); AlertManager alertManager = admin.getAlertManager(); alertManager.configure(new XmlAlertConfigurationParser("alerts.xml").parse()); ... Alert configuration settings can be changed (at runtime) for a pre-configured/pre-defined alert type. Enabling and Disabling of an alertA pre-configured but disabled alert can be easily enabled, but an already enabled alert type will need to be disabled prior to setting a new configuration. Enable a Disabled Predefined AlertFor a predefined but disabled alert, enable it by specifying the alert Class type. The configuration settings that were predefined will be used. alertManager.enableAlert(CpuUtilizationAlertConfiguration.class); Disable a Predefined Enabled AlertToo disable an existing alert (yet keep its configuration), use the following code: alertManager.disableAlert(CpuUtilizationAlertConfiguration.class); Re-configure a predefined alertFor a predefined alert, obtain the current configuration, change the settings and re-configure the AlertManager. CpuUtilizationAlertConfiguration config = alertManager.getConfig(CpuUtilizationAlertConfiguration.class); config.setHighThresholdPerc(85); alertManager.configure(config); Configure and enable a predefined disabled alertIf predefined settings need to be changed, get the configuration, change the settings, enable and re-configure. CpuUtilizationAlertConfiguration config = alertManager.getConfig(CpuUtilizationAlertConfiguration.class); config.setHighThresholdPerc(85); config.setEnabled(true); //don't forget alertManager.configure(config); Configure an Undefined AlertFor an alert which wasn't defined in the original set of alerts, create a new configuration with required settings and call configure. CpuUtilizationAlertConfiguration config = new CpuUtilizationAlertConfiguration(); config.setHighThresholdPerc(85); config.setLowThresholdPerc(70); config.setMeasurementPeriod(60, TimeUnit.SECONDS); config.setEnabled(true); alertManager.configure(config); Using the AlertConfigurerFor a more fluent API, AlertConfigurer implementations provide chaining methods. final AlertManager alertManager = admin.getAlertManager(); alertManager.setConfig( new CpuUtilizationAlertConfigurer() .raiseAlertIfCpuAbove(80) .resolveAlertIfCpuBelow(60) .create() ); alertManager.enableAlert(CpuUtilizationAlertConfiguration.class); Since 8.0.2 the enabled indication has been added to the AlertConfigurer API. This code sample does exactly the same as the code above. final AlertManager alertManager = admin.getAlertManager(); alertManager.setConfig( new CpuUtilizationAlertConfigurer() .raiseAlertIfCpuAbove(80) .resolveAlertIfCpuBelow(60) .enabled(true) //since 8.0.2 .create() ); |
![]() |
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence |