Mailing List Archive

Monitor a Pacemaker Cluster with ocf:pacemaker:ClusterMon and/or external-agent
I want to configure Event Notification with Monitoring Resources using
External Agent. I want to set notification on node failover from HA
perspective.
I follow below links

1)https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Configuring_the_Red_Hat_High_Availability_Add-On_with_Pacemaker/s1-eventnotification-HAAR.html

2)http://floriancrouzat.net/2013/01/monitor-a-pacemaker-cluster-with-ocfpacemakerclustermon-andor-external-agent/

3)http://clusterlabs.org/doc/en-US/Pacemaker/1.1-crmsh/html/Pacemaker_Explained/s-notification-external.html

Configured ClusterMon resource as

# pcs resource create ClusterMon-External ClusterMon --clone user=root \
update=30 extra_options="-E /var/lib/pgsql/9.3/data/test.sh -e
172.26.126.100"

vim test.sh

if [[ ${CRM_notify_rc} != 0 && ${CRM_notify_task} == "monitor" ]] || [[
${CRM_notify_task} != "monitor" ]] ; then
# This trap is compliant with PACEMAKER MIB
#
https://github.com/ClusterLabs/pacemaker/blob/master/extra/PCMK-MIB.txt
/usr/bin/snmptrap -v 2c -c public ${CRM_notify_recipient} ""
PACEMAKER-MIB::pacemakerNotification \
PACEMAKER-MIB::pacemakerNotificationNode s "${CRM_notify_node}" \
PACEMAKER-MIB::pacemakerNotificationResource s "${CRM_notify_rsc}" \
PACEMAKER-MIB::pacemakerNotificationOperation s "${CRM_notify_task}" \
PACEMAKER-MIB::pacemakerNotificationDescription s "${CRM_notify_desc}" \
PACEMAKER-MIB::pacemakerNotificationStatus i "${CRM_notify_status}" \
PACEMAKER-MIB::pacemakerNotificationReturnCode i ${CRM_notify_rc} \
PACEMAKER-MIB::pacemakerNotificationTargetReturnCode i
${CRM_notify_target_rc} && exit 0 || exit 1
fi
exit 0

But when failover occur there is no any notification. Where should I check
notification on 172.26.126.100 ip. I repeated these steps on both primary
and standby as I have 2 node HA.

Is it correct whatever I did?

Thank You,
Ranjan



--
View this message in context: http://linux-ha.996297.n3.nabble.com/Monitor-a-Pacemaker-Cluster-with-ocf-pacemaker-ClusterMon-and-or-external-agent-tp15951.html
Sent from the Linux-HA mailing list archive at Nabble.com.
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: Monitor a Pacemaker Cluster with ocf:pacemaker:ClusterMon and/or external-agent [ In reply to ]
I have CentOs 9.3 installed and using two VMs. That is I have two nodes HA
configuration. I configured one node as master and another as standby. I
have created three resources like vip-master, vip-rep and pgsql and again
creating resource as in following command. I want to configure HA failover
notification. When failover happen I want notification about fail node and
new master.

Once I execute following command
pcs resource create test ClusterMon ocf:pacemaker:ClusterMon params
user="root" update="30" extra_options="-E /usr/local/bin/test.sh" op monitor
on-fail="restart" interval="10" clone test-clone ClusterMon meta
target-role="Started"

Then I did # cibadmin --query > tmp.xml then check with tmp.xml. It has
entries for whatever resources created for HA along with test resource
created in above command.

Now I am using test.sh as external agent as

echo $CRM_notify_rc
echo $CRM_notify_task
echo $CRM_notify_recipient
echo $CRM_notify_node
echo $CRM_notify_rsc
echo $CRM_notify_desc
echo $CRM_notify_status
echo $CRM_notify_target_rc

After that I shut down cluster and start it again but no such notification
occur. I think test.sh is not get trigger. As per my knowledge
ocf:pacemaker:ClusterMon resource runs crm_mon at background. Then why
environment variables from test.sh not able to read cluster status from
crm_mon output.
I have also set permission to all for test.sh

Thank You,
Ranjan



--
View this message in context: http://linux-ha.996297.n3.nabble.com/Monitor-a-Pacemaker-Cluster-with-ocf-pacemaker-ClusterMon-and-or-external-agent-tp15951p15973.html
Sent from the Linux-HA mailing list archive at Nabble.com.
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: Monitor a Pacemaker Cluster with ocf:pacemaker:ClusterMon and/or external-agent [ In reply to ]
> On 26 Nov 2014, at 4:15 pm, Ranjan Gajare <ranjangajare92@gmail.com> wrote:
>
> I have CentOs 9.3

9.3? that would be impressive

can you tell me the version of pacemaker you have installed?
i suspect you're lacking this patch:
https://github.com/beekhof/pacemaker/commit/3df6aff

> installed and using two VMs. That is I have two nodes HA
> configuration. I configured one node as master and another as standby. I
> have created three resources like vip-master, vip-rep and pgsql and again
> creating resource as in following command. I want to configure HA failover
> notification. When failover happen I want notification about fail node and
> new master.
>
> Once I execute following command
> pcs resource create test ClusterMon ocf:pacemaker:ClusterMon params
> user="root" update="30" extra_options="-E /usr/local/bin/test.sh" op monitor
> on-fail="restart" interval="10" clone test-clone ClusterMon meta
> target-role="Started"
>
> Then I did # cibadmin --query > tmp.xml then check with tmp.xml. It has
> entries for whatever resources created for HA along with test resource
> created in above command.
>
> Now I am using test.sh as external agent as
>
> echo $CRM_notify_rc
> echo $CRM_notify_task
> echo $CRM_notify_recipient
> echo $CRM_notify_node
> echo $CRM_notify_rsc
> echo $CRM_notify_desc
> echo $CRM_notify_status
> echo $CRM_notify_target_rc
>
> After that I shut down cluster and start it again but no such notification
> occur. I think test.sh is not get trigger. As per my knowledge
> ocf:pacemaker:ClusterMon resource runs crm_mon at background. Then why
> environment variables from test.sh not able to read cluster status from
> crm_mon output.
> I have also set permission to all for test.sh
>
> Thank You,
> Ranjan
>
>
>
> --
> View this message in context: http://linux-ha.996297.n3.nabble.com/Monitor-a-Pacemaker-Cluster-with-ocf-pacemaker-ClusterMon-and-or-external-agent-tp15951p15973.html
> Sent from the Linux-HA mailing list archive at Nabble.com.
> _______________________________________________
> Linux-HA mailing list
> Linux-HA@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems