Writing Monitors for the Event Monitoring Service (December 1999)

144 Chapter5
Writing a Target Application
Target Application Overview
Target Application Overview
A target application is a process that receives notification messages
when the EMS API detects that a resource value has met the notification
criteria.
The target application does not necessarily use the EMS API. Depending
upon the notification method of a particular monitor request, the target
application may be able to process the notification message without
using any of the facilities of the EMS API. The TCP/IP and UDP/IP
notification methods, however, are designed to send data to a target
process using a specially-encoded message format. The encoding scheme
that is used to transport the notification message from the resource
monitor to the target application has not been published. Instead, the
rm_uncompress_object() function is provided in the EMS API to
convert a notification message into an EMS Notify Object. See the
section, “rm_uncompress_object” for more information.
There are no specifications for a target application, since they will be
determined by the notification method that is used. In fact, a target
application need not be an HP-UX process.
A resource monitor can be a target application. The resource monitor
would use the select_data parameter of the rm_get_next_event()
function to receive notifications. See the section, “rm_get_next_event” for
more information.
Target applications cannot use the EMS logging functions when they do
not call rm_monitor_start (). Target applications that also serve as
monitors can use the EMS logging functions because they will call the
rm_monitor_start () as part of the monitoring sequence. Target
applications can alternatively use user defined logging. Using the
syslog(3C) facility is not recommended due to the excessive system
messaging EMS might generate.
Table 5-1 EMS API Functions Used by Target Applications
rm_copy() Replicates an object.
rm_create() Creates an object of the type specified by the user.
rm_destroy() Frees the memory associated with an object.
rm_get() Returns a data item within an object.