2.7. Monitoring Agents

If resources cannot be monitored using a lightweight check, you should use a monitoring agent. The monitor action script contacts the monitoring agent to determine the status of the resource in the node. The monitoring agent in turn periodically monitors the resource. Figure 2-1 shows the monitoring process.

Figure 2-1. Monitoring Process

Monitoring agents are useful for monitoring database resources. In databases, creating the database connection is costly and time consuming. The monitoring agent maintains connections to the database and it queries the database using the connection in response to the monitor action script request.

Monitoring agents are independent processes and can be started by cmond process, although this is not required. For example, if a monitoring agent must be started when activating highly available services on a node, information about that agent can be added to the cmond configuration on that node. The cmond configuration is located in the /etc/failsafe/cmon_process_groups directory. Information about different agents should go into different files. The name of the file is not relevant to the activate/deactivate procedure.

If a monitoring agent exits or aborts, cmond will automatically restart the monitoring agent. This prevents monitor action script failures due to monitoring agent failures.

For example, the /etc/failsafe/cmon_process_groups/ip_addresses file contains information about the ha_ifd process that monitors network interfaces. It contains the following, where ACTIONS represents what cmond can perform on the agents (which will be the same for all scripts):

TYPE = cluster_agent
PROCS = ha_ifd
ACTIONS = start stop restart attach detach
AUTOACTION = attach

If you create a new monitoring agent, you must also create a corresponding file in the /etc/failsafe/cmon_process_groups directory that contains similar information about the new agent. To do this, you can copy the ip_addresses file and modify the PROCS line to list the executables that constitute your new agent. These processes must be located in the /usr/lib/failsafe/bin directory. You should not modify the other configuration lines (TYPE, ACTIONS, and AUTOACTION).

Suppose you need to add a new agent called newagent that consists of processes ha_x and ha_y. The configuration information for this agent will be located in the /etc/failsafe/cmon_process_groups/newagent file, which will contain the following:

TYPE = cluster_agent
PROCS = ha_x ha_y
ACTIONS = start stop restart attach detach
AUTOACTION = attach

In this case, the software will expect two executables (/usr/lib/failsafe/bin/ha_x and /usr/lib/failsafe/bin/ha_y) to be present.