Writing Monitors for the Event Monitoring Service (December 1999)
Chapter 3 61
Creating a Resource Monitor
Writing the Monitor
Writing the Monitor
The EMS API, Registrar, and resource dictionary directory are provided
as part of the EMS product. For each resource monitor you create, you
provide:
• A resource dictionary. Refer to the section “Defining the Resource
Dictionary Hierarchy” for information on writing this.
• The resource monitor binary file. The balance of this chapter
describes how to write this.
• A man page. This is optional, but strongly suggested. Refer users to
the man page in your resource dictionary entry.
• A message catalog. This is optional, but recommended for
localization.
Resource Monitor Minimums
To write your resource monitor, create a file with the following function
calls:
• rm_monitor_start()
This is a required function. The Registrar cannot recognize your
monitor until this is executed.
• rm_get_next_event()
This is a required function.
Place this rm_get_next_event() EMS API call in a loop so that the
monitor run in the loop waiting for the next event. The monitor
remains blocked on the call to rm_get_next_event() until the next
event occurs. At a terminate event the monitor breaks out of the loop
and exits.
The resource monitor is ready to communicate when it has called
rm_monitor_start() and rm_get_next_event().
• Entries for monitoring events.
Include functions (blocks of code) for processing events. Event types
include: