This topic lists the environment variables for fired alert data and their descriptions.

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

Environment Variables for Fired Alert Data

Variable

Description

Example Output

HYPERIC_ALERT_ALERT_ TIME

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

1219167000000

HYPERIC_ALERT_CONDI TION

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)

HYPERIC_ALERT_DESCRIP TION

The description of the alert that fired.

This alert will fire when the load rises

HYPERIC_ALERT_ID

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.

HYPERIC_ALERT_NAME

The name of the alert that fired.

High Load

HYPERIC_ALERT_PRIORITY

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

2

HYPERIC_ALERT_SUMMARY

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%)

HYPERIC_FIXED_ALERT_ID

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

HYPERIC_FIXED_ALERT_ NAME

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

High Load

HYPERIC_PLATFORM_NAME

The platform on which this alert fired.

localhost.hyperic.com

HYPERIC_RECOVERY_ALERT

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

False

HYPERIC_RESOURCE_ID

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

HYPERIC_RESOURCE_ NAME

The name of the resource for which the alert fired.

localhost.hyperic.com

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.

#!/usr/bin/perl
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;