[Pacemaker] crm_mon SNMP support

Florian Crouzat gentoo at floriancrouzat.net
Mon Dec 3 15:28:48 UTC 2012


Le 03/12/2012 03:27, Andrew Beekhof a écrit :
> 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.

If you have a suggestion as where this documentation should go, I might 
propose a patch. I'm not sure crm_mon --help or man crm_mon can be more 
verbose than they already are. Giving a full example and mentioning the 
ENV variables to use in the external-agent etc is too long for these 
brief doc.
What do you think ?

>>
>> 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


-- 
Cheers,
Florian Crouzat




More information about the Pacemaker mailing list