[Pacemaker] crm_mon SNMP support

Andrew Beekhof andrew at beekhof.net
Tue Dec 4 19:38:11 EST 2012


On Tuesday, December 4, 2012, Florian Crouzat wrote:

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


The proper place would be "pacemaker explained"
Happily it lives in the source tree (doc/Pacemaker_Explained/en-US/Ch-*) in
asciidoc format.
A patch with the details above would  be most welcome :)


>
>>> 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
>
> ______________________________**_________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/**mailman/listinfo/pacemaker<http://oss.clusterlabs.org/mailman/listinfo/pacemaker>
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/**doc/Cluster_from_Scratch.pdf<http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf>
> Bugs: http://bugs.clusterlabs.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20121205/53d3acc6/attachment-0003.html>


More information about the Pacemaker mailing list