Writing Monitors for the Event Monitoring Service (December 1999)
114 Chapter3
Creating a Resource Monitor
Processing a Resource Update Event
Sample Code
This code fragment shows how a resource monitor might respond to a
Resource Update Event.
RmStateName char * A state name. This field is a string of up to
256 characters with a terminating null.
RmStateValue sbit32 Identifies a signed 32-bit numeric value
associated with the string.
Table 3-8 Resource State Object Fields
Field Name Type Description
/*****************************************************************************/
/* File: update_resource.c */
/* */
/* Processes a Resource Update Event. */
/*****************************************************************************/
#include <monitor.h>
/*
* Resource monitor: update_resource
* Desc:
* Receives an event and, if it is a Resource Update Event,
* determines whether to send a Notification Message.
* Parms:
* None
* Returns:
* 0 Upon success
* !=0 Otherwise
*/
int update_resource(rm_object_addr obj)
{
rm_object_addr state_obj;
rm_error_type error_code;
rm_value_type value;
char *resource_name;
char state[20];
int rc;
time_t timer;