Product SiteDocumentation Site

7.6. Writing an Alert Agent

Table 7.2. Environment variables passed to alert agents

Environment Variable Description
The type of alert (node, fencing, or resource)
The version of Pacemaker sending the alert
The configured recipient
A sequence number increased whenever an alert is being issued on the local node, which can be used to reference the order in which alerts have been issued by Pacemaker. An alert for an event that happened later in time reliably has a higher sequence number than alerts for earlier events. Be aware that this number has no cluster-wide meaning.
A timestamp created prior to executing the agent, in the format specified by the timestamp-format meta-attribute. This allows the agent to have a reliable, high-precision time of when the event occurred, regardless of when the agent itself was invoked (which could potentially be delayed due to system load, etc.).
Name of affected node
Detail about event. For node alerts, this is the node’s current state (member or lost). For fencing alerts, this is a summary of the requested fencing operation, including origin, target, and fencing operation error code, if any. For resource alerts, this is a readable string equivalent of CRM_alert_status.
ID of node whose status changed (provided with node alerts only)
The requested fencing or resource operation (provided with fencing and resource alerts only)
The numerical return code of the fencing or resource operation (provided with fencing and resource alerts only)
The name of the affected resource (resource alerts only)
The interval of the resource operation (resource alerts only)
The expected numerical return code of the operation (resource alerts only)
A numerical code used by Pacemaker to represent the operation result (resource alerts only)

Special concerns when writing alert agents:


The alerts interface is designed to be backward compatible with the external scripts interface used by the ocf:pacemaker:ClusterMon resource, which is now deprecated. To preserve this compatibility, the environment variables passed to alert agents are available prepended with CRM_notify_ as well as CRM_alert_. One break in compatibility is that ClusterMon ran external scripts as the root user, while alert agents are run as the hacluster user.