hs_create_alarm

Description

Creates an alarm. An alarm is triggered when a data item value reaches a specified threshold value.   

Syntax

hs_create_alarm view_name, data_item_name, data_item_stat, alarm_action, alarm_action_data, alarm_value

Parameters

view_name

name of the view that contains the data item to which the alarm applies.

data_item_name

the data item to which the alarm applies. If the data item contains embedded spaces, surround it with quotation marks.

data_item_stat

statistic type for data_item_name. The data_item_name and data_item_stat combination must exist in the view definition. Surround the statistic type with quotation marks.

alarm_action

action to take when an alarm condition occurs. Values are:

alarm_action_data

specifies information required to carry out the alarm_action:

If alarm_action is

Then alarm_action_data is

log

Name of the file where Historical Server should log the alarm messages. The default is the Historical Server log file. If you specify a file that does not exist, Historical Server creates it. If you specify an existing file, the user who started Historical Server must have write permission for the file.

execute

Name of the file to execute, optionally followed by a list of parameters separated by spaces. The file must exist and the user who started Historical Server must have execute permission for it.

WARNING!  When an alarm condition occurs and alarm_action is execute, the specified file is executed by the account that started Historical Server, not by the account that created the alarm. This means that the access privileges of the person who starts Historical Server are available to the users who define alarms. A user who normally could not execute a file might be able to execute it through an Historical Server alarm.

alarm_value

triggering value for the alarm.

Examples

Example 1

  1. This example creates an alarm for a view named Page I/O. The view contains the Page I/O data item with a Value for Session statistic type. The data is logged to the page_io_alarm_file file when a trigger value of 50 or greater is achieved.

    hs_create_alarm PageIO,"Page I/O",
     "Value for Session",log,page_io_alarm_file,50
    
  2. This example creates an alarm for a view named Page I/O. This alarm causes the /user/script1 script to be executed and passed the value 100 as its first parameter when a trigger value of 100 or greater is achieved on the Page I/O data item.

    hs_create_alarm PageIO,"Page I/O",
     "Value for Session",execute,
     "/user/script1 100",100
    

Usage