Hi folks,<br><br>I&#39;m trying to find a good way to monitor rabbit for inclusion in an HA cluster (pacemaker/corosync).<br><br>Does anyone have a good resource agent already created for such a purpose?<br><br>Here is what I&#39;ve got so far:<br>

<br><br>#!/bin/bash                                                                                                                                                                                                <br>#######################################################################<br>

# Initialization:                                                      <br>. /usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs<br>#######################################################################<br><br>meta_data() {<br>

        cat &lt;&lt;END<br>&lt;?xml version=&quot;1.0&quot;?&gt;<br>&lt;!DOCTYPE resource-agent SYSTEM &quot;ra-api-1.dtd&quot;&gt;<br>&lt;resource-agent name=&quot;rabbitmq&quot; version=&quot;0.9&quot;&gt; <br>&lt;version&gt;1.0&lt;/version&gt;                         <br>

<br>&lt;longdesc lang=&quot;en&quot;&gt;<br>Rabbitmq agent      <br>&lt;/longdesc&gt;         <br>&lt;shortdesc lang=&quot;en&quot;&gt;Rabbitmq resource agent&lt;/shortdesc&gt;<br>&lt;actions&gt;<br>&lt;action name=&quot;start&quot;        timeout=&quot;90&quot; /&gt;<br>

&lt;action name=&quot;stop&quot;         timeout=&quot;100&quot; /&gt;<br>&lt;action name=&quot;monitor&quot;      timeout=&quot;20&quot; interval=&quot;10&quot; depth=&quot;0&quot; start-delay=&quot;0&quot; /&gt;<br>&lt;action name=&quot;meta-data&quot;    timeout=&quot;5&quot; /&gt;                                         <br>

&lt;action name=&quot;validate-all&quot;   timeout=&quot;30&quot; /&gt;                                      <br>&lt;/actions&gt;                                                                         <br>&lt;/resource-agent&gt;                                                                  <br>

END                                                                                <br>}                                                                                  <br><br>usage() {<br>        cat &lt;&lt;END<br>usage: $0 {start|stop|monitor|validate-all|meta-data}<br>

<br>END<br>}  <br><br>start() {<br>        /usr/sbin/rabbitmq-multi start_all 1 2&gt;&amp;1 &gt; /dev/null<br>        exit $?                                              <br>}                                                            <br>

<br>stop() {<br>  /usr/sbin/rabbitmq-multi stop_all 2&gt;&amp;1 &gt; /dev/null<br>  ret=$?                                            <br><br>  if [ $ret -eq 2 ]; then<br>    return $OCF_SUCCESS  <br>  fi                     <br>

<br>  if [ $ret -ne 0 ]; then<br>    sleep 5              <br>    pidof beam.smp       <br>    ret=$?               <br>    if [ $ret -eq 1 ]; then<br>      /usr/bin/killall -TERM epmd beam.smp<br>      sleep 30<br>      /usr/bin/killall -KILL epmd beam.smp<br>

    fi<br>  fi<br>  return $OCF_SUCCESS<br>}<br><br>monitor() {<br>  status=`/usr/sbin/rabbitmq-multi status 2&gt;&amp;1`<br>  res=$?<br>  if [ $res -eq 2 ]; then<br>    return $OCF_NOT_RUNNING<br>  fi<br><br>  if [[ $status =~ &#39;not_running&#39; ]]; then<br>

    return $OCF_NOT_RUNNING<br>  else<br>    if [ $res -eq 0 ]; then<br>      return $OCF_SUCCESS<br>    else<br>      return $OCF_ERR_GENERIC<br>    fi<br>  fi<br>}<br><br>validate() {<br>    return $OCF_SUCCESS<br>}<br>

<br>case $__OCF_ACTION in<br>meta-data)      meta_data<br>                exit $OCF_SUCCESS<br>                ;;<br>start)          start;;<br>stop)           stop;;<br>monitor)        monitor;;<br>validate-all)   validate;;<br>

usage|help)     usage<br>                exit $OCF_SUCCESS<br>                ;;<br>*)              usage<br>                exit $OCF_ERR_UNIMPLEMENTED<br>                ;;<br>esac<br>rc=$?<br>ocf_log debug &quot;${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc&quot;<br>

exit $rc<br><br><br>---------<br><br>It feels like a bit of a kludge though. If anyone has any suggestions on how to thoroughly monitor rabbit, please let me know.<br><br><br>Regards,<br><br>-- <br>Mark Steele<br>Director of development<br>

Bering Media Inc.<br><br><br>