|
From: | Isern Palaus |
Subject: | Multiple (changing) PIDs on a single file |
Date: | Wed, 12 Dec 2012 04:03:45 +0100 |
Hello, I am trying to configure monit to monitor "php-resque", https://github.com/chrisboulton/php-resque/tree/v1.1 . php-resque is a library to create background jobs. You can run a single worker to N, it does the job well. The problem: I can't monitor at all when it runs with N processes. Internally, while php-resque is executed will try to fork a process, if it's not running it will create a new one at when atleast one worker is still alive. It auto-prune dead workers and start new ones. This means that PIDs usually changes, now I've this running: PID 6028 running PID 6029 running PID 6030 running The problem is that the way php-resque works, if PID 6028 is dead, it will restart php-resque. This means killing all the PIDs and starting it. This isn't why I expected because if there is atleast one running PID it will always start all the missing ones. Situation (I've 3 workers running): PID 6028 not found running PID 6029 running PID 6030 running monit see that 6028 is not running, so it restarts: PID 6029 running PID 6030 running PID 13570 running PID 13571 running PID 13572 running When 6029 is found not running, it will do the same and add 3 more workers (becuase is what does /etc/init.d/php-resque start). I tried to search an example of similar situations but I don't find anything. What will be cool is to be able to check if all PIDs are dead and not only the first one. I see that you can check not only for process but for files: "check file apache_rc with path /etc/init.d/apache" so I assume that there is a way to using for example a bash script that will return "OK" or "ERROR" or something similar to let know monit what to do. I can't find documentation on this so I'm a bit lost. Thanks in advance, Isern |
[Prev in Thread] | Current Thread | [Next in Thread] |