Writing Monitors for the Event Monitoring Service (December 1999)

Chapter 3 65
Creating a Resource Monitor
Writing the Monitor
When you write the resource monitor, do not have it read from file
descriptor 0 (normally STDIN); it will be done automatically by the
rm_get_next_event() function.
Environment Considerations
A resource monitor’s environment is inherited from the Registrar, which
is inherited from inetd(1M).
Resource monitors should not expect user-type environment variables to
be present. In particular, HOME, DISPLAY, LANG, and NLSPATH will not be
set.
Terminal Considerations
There is no terminal associated with the resource monitor process, so it
is not possible to display information to the screen. Use the EMS logging
facilities to output information. See the chapter, “The EMS Application
Programming Interface (API)” for more information about EMS logging.
Monitor Info Object Considerations
When a resource monitor calls rm_monitor_start(), a Monitor Info
object of type RM_MONITOR_INFO_OBJECT is created, and the global
rm_monitor_info variable is set to point to that object. The
rm_monitor_info variable is of type rm_object_addr. Several fields of
the Monitor Info object are set automatically by the EMS API when the
object is created, and several fields must be set by the resource monitor.
The Monitor Info object fields are listed in Table 3-2:
Table 3-2 Monitor Info Object Fields
Field Name Type Description
RmMonitorCommand char * A pointer to a single
null-terminated string that is the
command line that was used to
invoke the monitor.
This field is set by EMS and
should not be modified.