[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit] Monitoring processes without a pidfile

From: Martin Pala
Subject: Re: [monit] Monitoring processes without a pidfile
Date: Mon, 21 Jul 2008 21:02:28 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20080615 Iceape/1.1.10 (Debian-1.1.10-1)

Currently the workaround is to create the pidfile from startup script:

If you need to mangle the service, you should do it via monit (like "monit restart <service>" since the service is controlled by monit and if for example the service stops by 3rd party process without monit knowing about it, monit will start it again.

We are also planning to add support for services controled directly by monit - monit then won't need the pidfile (it will be parent of such services and will know the pid).

The regular expression for process name won't be much reliable, since it could be easily cheated by any user (starting process with matching name) and there also can be cases where multiple matching processes will run whereas it can be hard to decide which process is the correct one, etc.


Daniel Clark wrote:
Is there syntax I'm missing or a "trick" to monitor a process where
the daemon does not support the use of pid files?

I've thought of wrapping the daemon in a shell script or something,
but that wouldn't work out with logrotate et all doing a "kill -HUP"
of the process (one could of course make that use the wrapper as well,
but then things start to seem really kludgey).

I guess what I'm looking for is something like the cfengine syntax for
doing this - e.g. determine if a process is running via a regexp of
the full name of the daemon and the command line it was fed.

It looks like this is currently possible with monit for stopping a
program (see example below), but not for detecting if a program is
running / seeing what its pid is.

check process mediawiki-searchd with pidfile /var/run/
  start program = "/usr/local/bin/searchd --config
  stop program = "/usr/bin/pkill -f
  if failed host port 3312 then restart
  if 5 restarts within 5 cycles then timeout


reply via email to

[Prev in Thread] Current Thread [Next in Thread]