Writing Monitors for the Event Monitoring Service (December 1999)

Chapter 3 93
Creating a Resource Monitor
Processing a Subclass Request Event
/*************************************************************************/
/* Define the state called “DOWN”, which has a value of 1. */
/*************************************************************************/
state_obj = rm_create(RM_RESOURCE_STATE_OBJECT, &error_code);
if (!state_obj) {
rm_perror(“Error in rm_create“, error_code);
return -1;
}
rc = rm_set(state_obj, RmStateValue, DOWN_STATE_VALUE, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
rc = rm_set(state_obj, RmStateName, DOWN_STATE_NAME, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
rc = rm_set(obj, RmStateObject, state_obj, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}
/*************************************************************************/
/* Define the state called “UNKNOWN”, which has a value of 2. */
/*************************************************************************/
state_obj = rm_create(RM_RESOURCE_STATE_OBJECT, &error_code);
if (!state_obj) {
rm_perror(“Error in rm_create“, error_code);
return -1;
}
rc = rm_set(state_obj, RmStateValue, UNKNOWN_STATE_VALUE, &error_code);
if (rc == -1) {
rm_perror(“Error in rm_set“, error_code);
return -1;
}