Writing Monitors for the Event Monitoring Service (December 1999)

64 Chapter3
Creating a Resource Monitor
Writing the Monitor
monitors cannot be started from an HP-UX shell. They must be started
by the registrar.
File Descriptor Considerations
The resource monitor is started by the Registrar. Before starting the
resource monitor process, the Registrar opens several file descriptors on
behalf of the resource monitor, including a communication channel
between the Registrar and the resource monitor.
It is important that the resource monitor does not close these file
descriptors, as it will render the resource monitor useless. Immediately
after a resource monitor successfully calls rm_monitor_start(), it will
have several file descriptors open. Table 3-1 lists the Open File
Descriptors.
NOTE The actual file descriptor numbers above number 4 may vary, since they
are opened by rm_monitor_start(), and the resource monitor may open
its own files before calling rm_monitor_start().
The named pipe allows other Registrars to contact the resource monitor.
Table 3-1 File Descriptors Open in Resource Monitor
File
Descriptor
File or Socket
0 Listen end of a named pipe in
/etc/opt/resmon/pipe/
monitorkey
1 EMS log file /etc/opt/resmon/log/api.log
2 Copy of file descriptor 1
3 EMS catalog file
/etc/opt/resmon/lib/nls/msg/C/resmon.cat
4 TCP/IP socket that is connected to the parent Registrar
5 (see note) Persistence file in
/etc/opt/resmon/persistence/m.
monitorkey
7 (see note) Write end of file descriptor 0