[rabbitmq-discuss] RabbitMQ and monit?
Steve Jenson
stevej at gmail.com
Wed Apr 9 17:44:43 BST 2008
On Wed, Apr 9, 2008 at 9:33 AM, Dmitriy Samovskiy
<dmitriy.samovskiy at cohesiveft.com> wrote:
> Hi Steve,
>
> You can obtain broker's OS process ID by something like this:
> sed 's/.*,\(.*\)\}.*/\1/' /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid
> or
> perl -ne 'm/,(.*)}/; print $1' /var/lib/rabbitmq/pids
>
> (put it somewhere inside startup script around echo SUCCESS)
I like that a lot better than the "clever" awk I whipped up:
awk 'BEGIN { RS="}"; FS=","} /([:digit:].*)/ {print $2}'
/var/lib/rabbitmq/pids > $PIDFILE
BTW, I had to install the deb on another machine so I could get the
/etc/init.d script.
Would it be possible to include it in the binary generic unix server
distribution?
> This will work if you have one rabbit node. If you have multiple, you can
> create multiple pid files for monit from /var/lib/rabbitmq/pids and monitor
> each process separately.
>
>
> And then for monit:
>
> check process rabbitmq-broker with pidfile /var/run/rabbitmq.pid
> start program = "/etc/init.d/rabbitmq start"
> stop program = "/etc/init.d/rabbitmq stop"
> if 5 restarts within 5 cycles then timeout
> alert someone at example.com only on { timeout }
>
> Something like this might work. Please note however that I don't actually
> run this setup - it's just how I might do it when I get around to it.
Thanks! I am going to set this up today and will email back with any
modifications I have to make.
Steve
More information about the rabbitmq-discuss
mailing list