Hyperic HQ 4.x Documentation : ui-Alert.Script
This page last changed on Jan 11, 2010 by marty.
Available only in HQ Enterprise Define a Script Action for an Alert*A script action allows you to access and use HQ 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.
Script actions can be defined for resource alerts and resource type alerts. In this version of HQ, escalation schemes do not support script actions. Environment Variables for Fired Alert DataThe environment variables for fired alert data are prefixed with the string "HYPERIC_". The table below describes the variables.
Example ScriptThe 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. alert.pl #!/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; Assign the Script Action to an AlertTo assign a script action to an alert definition:
|
![]() |
Document generated by Confluence on Apr 20, 2010 15:01 |