Entities

Entities are the fundamental units of observation/monitoring in the system. Essentially, an entity is a process (pid). As processes, all entities are uniquely identifiable by their pids. Associated with each entity is a symbolic name that can be used to refer to that specific entity. Again, the names associated with entities are unique across the system. Managers are currently associated with a node, so uniqueness rules apply to a node. As we'll see later, this uniqueness requirement is very similar to the naming scheme used in a hierarchical filesystem.

The basic entity types are:

Self-attached entities
These are processes that explicitly choose to be HA-aware. These processes use the ham_attach_self() and ham_detach_self() functions to connect to and disconnect from a HAM. Self-attached processes are compiled against the HAM API library, and the lifetime of the monitoring is from the time of the ham_attach_self() call to the time of the ham_detach_self() call.

Self-attached entities can also choose to send heartbeats to a HAM, which will then monitor them for failure. Since arbitrary processes on the system aren't necessarily “trackable” for failure (i.e., they're not in session 1, not child processes, etc.), you can use this heartbeat mechanism to monitor such processes.

Self-attached entities can, on their own, decide at exactly what point in their lifespan they want to be monitored, what conditions they want acted upon, and when they want to stop the monitoring. In other words, this is a situation where a process says, “Do the following if I die.”

Externally attached entities
These are generic processes in the system that are being monitored. These could be arbitrary daemons or service providers whose health is deemed important. This method is useful for the case where Process A says, “Tell me when Process B dies” but Process B needn't know about this at all.
Global entity
A global entity is really just a placeholder for matching any entity. It can be used to associate actions that will be triggered when an interesting event is detected with respect to any entity on the system. The term global refers to the set of entities being monitored in the system. This permits one to say things like “when any process dies or when any process misses a heartbeat, do the following”. The global entity is never added or removed, but is only referred to. Conditions can be added/removed to the global entity as usual, and actions added/removed from any of the conditions.
Note: To get a handle for a global entity, call ham_entity_handle(), passing NULL for the ename argument.

The dumper process is normally used to obtain core images of processes that terminate abnormally as a result of performing any illegal operations. A HAM receives notification of such terminations from dumper. In addition the HAM also receives notification, from the system, of the termination of any process that is in session 1. This includes daemon processes that call procmgr_daemon(), thereby detaching themselves from their controlling terminal.

If a process calls daemon(), a new process is created and replaces the original one, becoming the session leader. If the HAM was monitoring the original process, it automatically switches to monitoring the new process instead.