Simple task like setting up monitoring with monit for rabbit mq include two parts:

  1. As discussed here Modify /etc/init.d/rabbitmq-server
The following are added to the start
    pid=`/usr/sbin/rabbitmqctl status | perl -n -e'/{pid,(\d+)/ && print $1'`
    echo $pid > /var/run/
    Right before:
    echo SUCCESS The pid file is deleted within the stop function:
              rm /var/run/ right after,
              if [ $RETVAL = 0 ] ; then
  1. Add this to monit configuration file:
### rabbitmq-server
    check process rabbitmq-server with pidfile /var/run/
    group rabbitmq
    start program "/etc/init.d/rabbitmq-server start"
    stop program "/etc/init.d/rabbitmq-server stop"
    if failed port 5672 type tcp then restart
    if 3 restarts within 3 cycles then timeout


comments powered by Disqus