Id like to monitor the rabbitmq process using monit which requires a
pid file, looking trough web posts they mention the /var/lib/rabbitmq/
pids as the source for the pid file however this folder doesn't
exits.
Any idea how to provide a pid file for monit without the pids folder?
Thanks
Ronen
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq...@lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Do something like:
setsid sh -c 'echo $$ >$PIDFILE ; exec rabbitmq-server </dev/null >$RABBITMQ_LOG_BASE/rabbitmq_startup_log 2>&1' &
rabbitmqctl wait >/dev/null 2>&1
David
--
David Wragg
Staff Engineer, RabbitMQ
VMware, Inc.
$ rabbitmqctl status
Status of node rabbit@hazel ...
[{pid,30451},
...]
Yes, that will require some parsing to safely get that out (the order of
items in that list could potentially change), but a regex of
/{pid,\s*(\d+)/ (or some such) should be sufficient.
Matthew
"setsid sh -c 'echo $$ >$PIDFILE ; exec rabbitmq-server </dev/null >
$RABBITMQ_LOG_BASE/rabbitmq_startup_log 2>&1' &
rabbitmqctl wait >/dev/null 2>&1"
As the monit command entry or to use it within the init file itself?
Matthew, I did see the pid entry under the status, I was hopping to
skip the need of parsing it but I guess ill have to try it also
Thanks
Ronen
On Jul 5, 3:44 pm, Matthew Sackman <matt...@rabbitmq.com> wrote:
> On Tue, Jul 05, 2011 at 05:33:02AM -0700, Ronen wrote:
> > Any idea how to provide a pid file for monit without the pids folder?
>
> $ rabbitmqctl status
> Status of node rabbit@hazel ...
> [{pid,30451},
> ...]
>
> Yes, that will require some parsing to safely get that out (the order of
> items in that list could potentially change), but a regex of
> /{pid,\s*(\d+)/ (or some such) should be sufficient.
>
> Matthew
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc...@lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
I think either approach would work ok, though both have drawbacks.
Editing the init file is a drawback from a maintanence pov, though the
solution there is more robust.
Using rabbitmqctl means you'll have a potential race - you'll think
you've started rabbit, but it can be a while before rabbitmqctl status
thinks rabbit's managed to start up. You could use rabbitmqctl wait in
this case, but that adds further complexity, and is buggy anyway!
Matthew
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq...@lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
You'll need to incorporate that into a script that monit runs. It
should be easy to incorporate into the rabbitmq-server init script,
which already contains commands very like those.
--
David Wragg
Staff Engineer, RabbitMQ
VMware, Inc.
The following are added to the start function:
pid=`/usr/sbin/rabbitmqctl status | perl -n -e'/{pid,(\d+)/ && print
$1'`
echo $pid > /var/run/rabbitmq.pid
Right before:
echo SUCCESS
The pid file is deleted within the stop function:
rm /var/run/rabbitmq.pid
right after,
if [ $RETVAL = 0 ] ; then
Thanks David and Matthew
Ronen
On Jul 5, 4:46 pm, David Wragg <da...@rabbitmq.com> wrote:
> Ronen <nark...@gmail.com> writes:
> > David did you mean to use:
>
> > "setsid sh -c 'echo $$ >$PIDFILE ; exec rabbitmq-server </dev/null >
> > $RABBITMQ_LOG_BASE/rabbitmq_startup_log 2>&1' &
> > rabbitmqctl wait >/dev/null 2>&1"
>
> > As the monit command entry or to use it within the init file itself?
>
> You'll need to incorporate that into a script that monit runs. It
> should be easy to incorporate into the rabbitmq-server init script,
> which already contains commands very like those.
>
> --
> David Wragg
> Staff Engineer, RabbitMQ
> VMware, Inc.
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc...@lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss