Writing Monitors for the Event Monitoring Service (December 1999)
46 Chapter2
The EMS Application Programming Interface (API)
Function Descriptions
rm_monitor_start
Called by resource monitors before using any other functions that are
part of the EMS API. The purpose of this function is to register the
process as a resource monitor with the EMS API and to allow the EMS
API to initialize the communication path to the Registrar.
Function Prototype
int rm_monitor_start ( int argc, char **argv,
rm_error_type *error_code );
Parameters
argc
The number of arguments that were passed to the resource
monitor by the parent process.
argv
An array of character strings representing the program’s
arguments.
error_code
Provides additional information about failure conditions of
the function. Valid values are listed in the file
/opt/resmon/include/resmon.h.
Returned Value
If an error occurs, rm_monitor_start() returns -1. The error_code
provides additional information.
Usage Notes
The rm_monitor_start() function sets up communication with the
Registrar. It also creates an EMS object of type
RM_MONITOR_INFO_OBJECT, which contains information about the
resource monitor. The resource monitor must fill in several fields of this
object, including the title, version, and vendor of the resource monitor.
See the chapter, “Creating a Resource Monitor” for more information.
The rm_monitor_start() function also opens the log file
/etc/opt/resmon/log/api.log, which enables the EMS logging
functions.
In order to minimize potential timeouts when communicating with a
monitor, call rm_monitor_start and rm_get_next_event (in that order)
as soon as possible in your monitor code.