EMS Manual

Procedure Calls for Standard Events
EMS Manual426909-005
11-42
Usage Threshold Programming Example
float config_high_level = 0;
float config_low_level = 0;
short util_unit = ZEMS_VAL_UTIL_UNIT_PERCENT;
float current_util_level = 0;
short result;
short myap_evt_usage_threshold = 108;
char line_name[LINE_NAME_LEN] = "value of the subject ";
short zcom_ssid[6];
char token_value[TOKEN_LENGTH] = "token value ";
short status;
short coll_name_len = sizeof(coll_name) - 1;
strncpy(myap_ssid.u_z_filler.z_filler, MYAP_VAL_OWNER, 8);
myap_ssid.z_number = MYAP_SSN_MYAP;
myap_ssid.z_version = MYAP_VAL_VERSION;
/*
* Open the EMS collector
*/
FILE_OPEN_ (coll_name, coll_name_len, &coll_num);
printf(" coll_num = %d\n", coll_num);
/*
* Initialize usage Threshold Control block
*/
if (status = EMS_UTCB_INIT_ (
usage_threshold_cb /* return Usage Threshold
Control Block*/
, config_high_level /* configured high level */
, config_low_level /* configured low level */
, util_unit)) /* utilization unit */
handle_error_utcb_init(status);
/*
* Check to see if the current utilization level exceeds the
* threshold and needs to be reported.
*/
status = EMS_USAGE_THRESHOLD_CHK_ (
current_util_level /* current utilization level
*/
, usage_threshold_cb /* usage threshold block */
, &result); /* return zspi_val_true if
the event */
/* should reported. */
if ((status == 0) && (result == ZSPI_VAL_TRUE))
{
if (status = EMS_USAGE_THRESHOLD_EVT_BLD_ (
buffer /* event buffer
*/
, ZEMS_VAL_EVT_BUFLEN /* event buffer
length */
, (short*)&myap_ssid /* ssid */
, myap_evt_usage_threshold /* event number