Setup
I'm currently having a working 2-nodes HA cluster using Pacemaker+Corosync. My nodes are running on Debian 8 (Jessie). Now I would be able to get notified when changes occur in the cluster (resources stop/start, promote/demote, move...).
Since email reporting is so-2008, I'd like to use Slack.
To do that, I created a script that uses curl
to post a message to my team's Slack channel, using Slack's webhooks. My script is using environment variables that are documented here: Pacemaker - 7.3. Configuring Notifications via External-Agent.
The script works fine when executing manually in the shell and is able to post on the specified channel. It also logs to /var/log/ocf-notifier.log
.
Problem
Based on this answer, I created a new resource in the cluster using Pacemaker's ocf:pacemaker:ClusterMon
resource agent, which calls my custom script (/usr/local/bin/ocf-notifier
).
However I noticed that my script is simply not called at all when changes occur in the node (tried stopping resource as well as completely shutting down a node).
Therefore, I tried to launch crm_mon
by hand like the following:
$ crm_mon -Arf --interval=2 -E /usr/local/bin/ocf-notifier -e '@jordan'
And see if this could trigger the thing by playing around with the cluster with another shell. As it turns out, crm_mon
was able to see the changes happening in the cluster (node going offline, resource being stopped/started...), but my custom script never blinked an eye. My custom log file remains empty, and nothing appears in Slack since I believe the script is simply not called.
TL;DR
crm_mon
does not call the external agent on cluster events, as it should with -E
option.
What am I doing wrong?