set_alarm_ranges()

含义:Set the range for the alarm conditions for a particular application or parameter(对特定的应用或参数设置告警阈值)

Format

set_alarm_ranges(new_rangs,param,appl,[param_oid],[path])

Parameters

Parameter

Definition

new_ranges

newline-separated list of alarm range settings


The first element of the list is the setting for the border alarm, the second element is for the first alarm zone (Alarm1), and the third element is for the second alarm zone (Alarm2).


Each element of the list is in the following the format:
active min max trigger max_occ state
active = 1 or 0 indicating whether the alarm is active
min = integer indicating the minimum of the zone
max = integer indicating the maximum of the zone
trigger = integer indicating how many times the parameter value must be
in the range before triggering
  0 immediately on alarm
  1 after alarm has occurred n times
  2 after all recovery actions fail
max_occ = maximum number of times the alarm occurs
state = 0(OK) or 1(WARN) or 2(ALARM) indicating what action occurs

param

name of the parameter that is monitored

appl

either the name of the application or the application instance objectid

param_oid

optional parameter objectid

path

optional path to the parameter

Description

The set_alarm_ranges() function sets the range for the alarm conditions for a particular application or parameter.

Although param and appl are required, they can be "" if param_oid or path or both are supplied.

Calls to the set_alarm_ranges() function that specify the param and appl parameters without the param_oid and path parameters set the alarm ranges for the parameter class and affect all parameter instances of that class.

However, calls to the set_alarm_ranges() function that specify the param_oid and path parameters set the alarm ranges for that particular parameter instance and do not affect the alarm ranges for other instances of that class.

Return Value

The function returns the string "not found" if the parameter class cannot be found.Otherwise, it returns a number indicating which ranges were correctly set. The binary representation of the number should be considered. If the first bit is set, then the setting of the first range (border alarm range) has failed. If the second bit is set, the setting of the Alarm1 range has failed, and so on.

The following example changes the alarm ranges for the
/NT_EVLOGFILES/NT_EVAPP/ELMEvFileFreeSpacePercent parameter, but does not change /NT_EVLOGFILES/NT_EVSEC/ELMEvFileFreeSpacePercent or /NT_EVLOGFILES/NT_EVSYS/ELMEvFileFreeSpacePercent

new_ranges= "1 0 100 0 0 2\n1 5 10 0 0 1\n1 10 100 0 0 2";
result=set_alarm_ranges(new_ranges,"","","","/NT_EVLOGFILES/NT_EVAPP/ELMEvFileFreeSpacePercent");

The following example changes the alarm ranges for all three parameters:
/NT_EVLOGFILES/NT_EVAPP/ELMEvFileFreeSpacePercent,
/NT_EVLOGFILES/NT_EVSEC/ELMEvFileFreeSpacePercent, and
/NT_EVLOGFILES/NT_EVSYS/ELMEvFileFreeSpacePercent.

new_ranges= "1 0 100 0 0 2\n1 5 10 0 0 1\n1 10 20 0 0 2";
result=set_alarm_ranges(new_ranges,"ELMEvFileFreeSpacePercent","NT_EVLOGFILES");

The following example shows how to use the object ID to set the alarm ranges of a parameter:

new_ranges="1 0 100 0 0 0\n1 0 90 0 0 0\n1 91 100 0 0 2";
oid=get("/linux/linux/CpuUtil/objectId");
printf("oid=%d\n",oid);
resutl=set_alarm_ranges(new_ranges,"","",oid,"/linux/linux/CpuUtil");

Example

Code:

new_ranges="1 0 100 0 0 0\n1 0 90 0 0 0\n1 91 100 0 0 2";
oid=get("/linux/linux/CpuUtil/objectId");
printf("oid=%d\n",oid);
resutl=set_alarm_ranges(new_ranges,"","",oid,"/linux/linux/CpuUtil");

Output:

BMC PSL function(31)-set_alarm_ranges()_set_alarm_ranges()

BMC PSL function(31)-set_alarm_ranges()_set_alarm_ranges()_02

BMC PSL function(31)-set_alarm_ranges()_set_alarm_ranges()_03

BMC PSL function(31)-set_alarm_ranges()_set_alarm_ranges()_04