Monitoring pacemaker with url trigger external agent

I have a HA setup, which now the only resource configured is Heartbeat with Active/Passive Configuration. Both running Debian 7, 64-bit in the cloud.

Now i want to trigger an URL with the information from the Pacemaker when the resource changes. The URL is pointed to some server which will send E-mail/an SMSalert ect.. Let the URL triggered be http://example.com/pacemaker.php?CRM_notify_node=node1&CRM_notify_rsc=blah

Since Configuring all the stuff in Pacemaker is lil tedious. So all the processing or sending E-mail/alerts is put into the webpage.

So, how to configure the Pacemaker to call the URL.

Thanks


You can configuring Notifications via External-Agent adding external script to process cluster changes.

For example configure ClusterMon to execute an external-agent:

primitive ClusterMon ocf:pacemaker:ClusterMon \
    params user="root" update="30" extra_options="-E /path/to/pcmk_curl_helper.sh" \
    op monitor on-fail="restart" interval="10"

clone ClusterMon-clone ClusterMon \
    meta target-role="Started"

Script pcmk_curl_helper.sh:

#!/bin/bash

# Generates alerts for any failing monitor operation or
# for any operations (even successful) that are not a monitor
# env vars: ${CRM_notify_recipient} ${CRM_notify_rsc} ${CRM_notify_rsc} ${CRM_notify_desc} ${CRM_notify_status} ${CRM_notify_rc} ${CRM_notify_target_rc}

if [[ ${CRM_notify_rc} != 0 && ${CRM_notify_task} == "monitor" ]] || [[ ${CRM_notify_task} != "monitor" ]] ; then

    /usr/bin/curl -sS http://example.com/pacemaker.php?CRM_notify_node=${CRM_notify_node}&CRM_notify_rsc=${CRM_notify_rsc} > /dev/null

fi
exit 0

Alternatively you can start crm_mon as a background daemon and use same script to process cluster changes.

Eg.

crm_mon -d -i 30 -p /tmp/ClusterMon_ResourceMonitor.pid -E /path/to/pcmk_curl_helper.sh

I hope this help.