[Pacemaker] crm_mon SNMP support

Andrew Beekhof andrew at beekhof.net
Mon Dec 3 02:27:45 UTC 2012


On Sat, Dec 1, 2012 at 1:07 AM, Florian Crouzat
<gentoo at floriancrouzat.net> wrote:
> Le 29/11/2012 22:10, Andrew Beekhof a écrit :
>
>
>> Not so fast :-)
>>
>> crm_mon supports
>>
>>         -E, --external-agent=value
>>                A program to run when resource operations take place.
>>
>>         -e, --external-recipient=value A recipient for your program
>> (assuming you want the program to send something to someone).
>>
>> so without recompiling, you can call a script - possibly it could call
>> something that sends out snmp alerts ;-)
>
>
>
> Oh, great!
>
> I had a hard time understanding these two options and how they relate, you
> helped me on IRC but I'll reply here so there is a trace in case someone is
> also interested.

Thanks for that. I really need to make some time to document this.

>
> Here is my resource:
>
> primitive ClusterMon ocf:pacemaker:ClusterMon \
>         params user="root" update="30" extra_options="-E
> /usr/local/bin/foo.sh -e 192.168.1.2" \
>         op monitor on-fail="restart" interval="10" \
>         meta target-role="Started"
> clone ClusterMon-clone ClusterMon
>
> Here is the content of my script:
>
> $ cat /usr/local/bin/foo.sh
>
> #!/bin/bash
>
> (
> echo CRM_notify_recipient $CRM_notify_recipient
> echo CRM_notify_node $CRM_notify_node
> echo CRM_notify_rsc $CRM_notify_rsc
> echo CRM_notify_task $CRM_notify_task
> echo CRM_notify_desc $CRM_notify_desc
> echo CRM_notify_rc $CRM_notify_rc
> echo CRM_notify_target_rc $CRM_notify_target_rc
> echo CRM_notify_status $CRM_notify_status
> echo
> ) > /tmp/pacemaker.log
>
> Finally, this is the resulting log of one execution. The script is executed
> on each cluster operation/transition (monitor, stop, start) etc.
>
> $ cat /tmp/pacemaker.log
>
> CRM_notify_recipient 192.168.1.2
> CRM_notify_node scoresby2.lyra-network.com
> CRM_notify_rsc F
> CRM_notify_task monitor
> CRM_notify_desc ok
> CRM_notify_rc 0
> CRM_notify_target_rc 0
> CRM_notify_status 0
>
> One just has to do some scripting with these variables to match its needs.
> In my case, I guess I want a SNMP trap whenever CRM_notify_rc != 0.
>
> Thanks
>
>
> --
> Florian Crouzat
>
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org




More information about the Pacemaker mailing list