Product SiteDocumentation Site

7.3. Configuring Notifications via External-Agent

Requires a program (external-agent) to run when resource operations take place, and an external-recipient (IP address, Email address, URI). When triggered, the external-agent is fed with dynamically filled environnement variables describing precisely the cluster event that occurred. By making smart usage of these variables in your external-agent code, you can trigger any action.

Example 7.3. Configuring ClusterMon to execute an external-agent

<clone id="ClusterMon-clone">
    <primitive class="ocf" id="ClusterMon" provider="pacemaker" type="ClusterMon">
        <instance_attributes id="ClusterMon-instance_attributes">
            <nvpair id="ClusterMon-instance_attributes-user" name="user" value="root"/>
            <nvpair id="ClusterMon-instance_attributes-update" name="update" value="30"/>
            <nvpair id="ClusterMon-instance_attributes-extra_options" name="extra_options" value="-E /usr/local/bin/example.sh -e 192.168.12.1"/>
        </instance_attributes>
    </primitive>
</clone>

Table 7.1. Environment Variables Passed to the External Agent

Environment Variable Description
CRM_notify_recipient
The static external-recipient from the resource definition.
CRM_notify_node
The node on which the status change happened.
CRM_notify_rsc
The name of the resource that changed the status.
CRM_notify_task
The operation that caused the status change.
CRM_notify_desc
The textual output relevant error code of the operation (if any) that caused the status change.
CRM_notify_rc
The return code of the operation.
CRM_notify_target_rc
The expected return code of the operation.
CRM_notify_status
The numerical representation of the status of the operation.