Set Up Alert Action Script

Available only in vFabric Hyperic

Define a Script Action for an Alert

A script action allows you to access and use Hyperic environment variables that contain information about a fired alert. You can use the data in any fashion you wish, for instance in a web service call to external management system.

To use the script action feature, write a script that implements the action or logic you wish to perform with the alert-related environment variables. When you configure the alert, specify the script to be executed when the alert fires. The script is server-side only, meaning it must be accessible and executable by the same user running the HQ Server process.

Agent-side Scripts

If you wish to execute agent-side scripts, see Configure a Custom Control Action.

Script actions can be defined for resource alerts and resource type alerts. In this version of Hyperic, escalation schemes do not support script actions.

Script actions are synchronous

Script actions execute one at a time. Until a script action completes, additional alerts will not fire on the resource.

Script actions and memory

Script actions are forked by the the Hyperic Server's Java process. Most operating systems duplicate the Java process's memory before executing the new process; exact behavior varies by operating system. If the operating system does not provide for over-committing memory, script execution requires an amount of free memory equal to the amount of memory that the Hyperic Server's Java process consumes — otherwise, the script action will not run.

Environment Variables for Fired Alert Data

The environment variables for fired alert data are prefixed with the string "HYPERIC_". The table below describes the variables.



Example Output


The time at which the  alert fired, in milliseconds from epoch.



The condition that caused the alert to fire. Note:  This environment variable is supported only on Unix-based platforms. The value contains the Java \n character, which causes errors under Windows. In Windows environments, use the HYPERIC_ALERT_SUMMARY variable, which provides the same information without the \n character.

If Load Average 5 Minutes > 1.0 (actual value = 1.4)


The description of the alert that fired. 

This alert will fire when the load rises


The internal Hyperic ID for the alert that fired.

Note: The HYPERIC_ALERT_ID for an alert is not committed to the Hyperic database until all alert actions are complete. Therefore, an alert action script (whether it uses SQL or HQApi) cannot query or update the Hyperic database using the alert's HYPERIC_ALERT_ID, because that value will not yet exist in the Hyperic database.



The name of the alert that fired.

High Load


The priority of the alert that fired, 1 for High, 2 for Medium, 3 for Low.



A condensed data string that contains the relevant alert and resource names and values which triggered the alert.

Mac OS X DOWN The-Idea-Men Availability (0.0%)


This variable was added in Hyperic

Valid for recovery alerts only. Supplies the internal Hyperic ID for the primary alert to which the recovery alert is assigned.



This variable was added in Hyperic

Valid for recovery alerts only. Supplies the name of the primary alert to which the recovery alert is assigned.

High Load


The platform on which this alert fired.


A boolean that indicates if the alert is a recovery alert.



The internal ID for the resource for which the alert fired.



The name of the resource for which the alert fired.

Example Script

The following script is an example of using the alert variables. The example script simply writes the time that the script executed and the variables to a log file; it is not a representative use case. The purpose of script actions is to enable more complex alert actions, and actions that meet the unique needs of your environment.
my $logfile = "/tmp/output.txt";
my $date = localtime();
open LOGFILE, ">$logfile" or die "Cannot open log file for writing";
print LOGFILE "# Running script at $date", "\n";
foreach $key (sort keys(%ENV)) {
if ($key =~ m/^HYPERIC/) {
my $msg = "$key = $ENV{$key}";
print LOGFILE $msg, "\n";
close LOGFILE;

Assign the Script Action to an Alert

To assign a script action to an alert definition:

  1. Select the alert definition.

  2. Click the Script tab in the Alert Definition page.

  3. Enter the full path to script and click Set.