monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Newbie question: failing to start services


From: Martin Pala
Subject: Re: [monit] Newbie question: failing to start services
Date: Fri, 25 Apr 2008 23:42:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080313 Iceape/1.1.9 (Debian-1.1.9-2)

This is most probably caused by missing environment variable. Monit sets spartan environment/sandbox when starting services.

Here is FAQ item regarding short description from FAQ (http://www.tildeslash.com/monit/doc/faq.php):

--8<--
6. Q: I'm having trouble getting monit to execute any "start" or
      "stop" program commands.  The log file says that they're being
      executed, and I can't find anything wrong when I run monit in
      verbose mode.

   A: Monit did start the program but for some reason the service dies
      later. Before we go on and introduce you to the fine art of
      system debugging, it's worth to note that:

      For security reasons monit purges the environment and only set a
      spartan PATH variable that contains /bin, /usr/bin, /sbin and
      /usr/sbin. If your program or script dies, the reason could be
      that it expects certain environment variables or to find certain
      programs via the PATH. If this is the case you should set the
      environment variables you need directly in the start or stop
      script called by monit.
--8<--

It's possible that your scripts need some environment variable which is missing ... simply add everything what is needed to your scripts.


Martin




Guby wrote:
Hi
This is my first try setting up monit on a server. I am hearing monit is a great app, and I am looking forward to having it monitor my apps and give me peace of mind, once I get so far...

I have set up a bunch of services which can be started manually like this:

sudo /etc/init.d/worker1
sudo /etc/init.d/worker2
sudo /etc/init.d/scheduler
sudo /etc/init.d/beanstalkd

When starting them manually everything works like a charm. The processes therefore seem to work the way I intend them to.

When trying to start them using monit, it tells me it can't start the processes and unmonitors them. If, on the other hand, the processes already run when I start monit, monit sees them and sets their state to running and tells me it is monitoring them. That is not to reassuring though, because if monit needs to restart the process it probably wont be able to, and then part of the reason for having monit running disappears!

The monit configuration for the processes look like this:

check process worker1 with pidfile "/home/sebastian/public_html/kle.io/shared/log/Worker1.pid"
    start program = "/etc/init.d/worker1 start"
    stop program = "/etc/init.d/worker1 stop"
     if cpu usage is greater than 90 percent for 2 cycles then alert
     if cpu usage > 98% for 5 cycles then restart
    if 2 restarts within 3 cycles then timeout
    group workers
    depends on beanstalkd

check process worker2 with pidfile "/home/sebastian/public_html/kle.io/shared/log/Worker2.pid"
    start program = "/etc/init.d/worker2 start"
    stop program = "/etc/init.d/worker2 stop"
     if cpu usage is greater than 90 percent for 2 cycles then alert
     if cpu usage > 98% for 5 cycles then restart
     if 2 restarts within 3 cycles then timeout
    group workers
    depends on beanstalkd

check process beanstalkd with pidfile "/var/run/beanstalkd.pid"
    start program = "/etc/init.d/beanstalkd start"
    stop program = "/etc/init.d/beanstalkd stop"
     if cpu usage is greater than 10 percent for 2 cycles then alert
     if cpu usage > 98% for 5 cycles then restart
     if 2 restarts within 3 cycles then timeout

Thanks in advance!

Best regards
Sebastian




--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

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