Writing Monitors for the Event Monitoring Service (December 1999)
Chapter 5 149
Writing a Target Application
Target Application Overview
/*************************************************************************/
/* Check object type */
/*************************************************************************/
if (rm_get(obj, RmObjectType, &object_type, &error_code) == -1) {
rm_strerror(error_code, errbuf, sizeof(errbuf));
fprintf(stderr, "Could not get object type: %s", errbuf);
}
/*************************************************************************/
/* Format and print object based on object type */
/*************************************************************************/
else if (object_type == RM_NOTIFY_OBJECT) {
format_notify_object(obj);
}
else if (object_type == RM_RESTART_NOTIFICATION_OBJECT) {
format_restart_object(obj);
}
else {
printf("Unknown object type\n");
}
free(buf);
(void) close(datasock);
} /* while (1) */
} /* end main */