[Top][All Lists]

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

[monit] Re: Quick M/Monit question

From: Christopher Opena
Subject: [monit] Re: Quick M/Monit question
Date: Tue, 10 Mar 2009 23:57:00 -0800

Strike my questions, answered them now by configuring an include file for a dev site and running some tests.  For those interested:

1) Does my service group show up in the service group drop-down in the events tab if it has no events?
ANSWER:  No.  Once you do generate an event it will show up.

2) Does Chris's syntax look correct under the 'start program' directive?
ANSWER:  No.  It was actually failing because he had a cd (change directory) command under there as well and you have to use /bin/bash -c to get to the cd command.  Additionally, monit has support for 'as uid' and 'as gid' so you don't have to '/bin/su' to get to it.  Here's what the final command looks like, tested as working:

start program = "/bin/bash -c 'cd /path/to/a/directory; LOCAL_VAR={local_var} /path/to/a/script start -d'" as uid {user} and gid {group} with timeout 60 seconds
stop program = "/bin/bash -c 'cd /path/to/a/directory; LOCAL_VAR={local_var} /path/to/a/script stop'" as uid {user} and gid {group}

Yay, it's always fun answering your own questions!


On Tue, Mar 10, 2009 at 7:53 PM, Christopher Opena <address@hidden> wrote:
Hello all, just a quick question about the M/Monit status pages and some questions around starting | stopping binaries from within M/Monit.  First, a quick background on my config:

I'm using M/Monit 2.0_beta6-linux-x64 with a pretty standard monitrc on the remote host (httpd, postgresql, mysql, filesystem, cpu, mem, etc.) except that I am monitoring extant custom processes for multiple virtual hosts.  I'm using an include statement at the bottom of my monitrc that drops in the monitored services for each virtual host.  A given include file looks something like this:

check process dev_bjs with pidfile /path/to/pid/
   start program = "/bin/su -c '/path/to/start/script start -d'" with timeout 60 seconds
   stop program = "/bin/su -c '/path/to/start/script stop''"
   if cpu > 15% for 2 cycles then alert
#   if cpu > 80% for 5 cycles then restart
   if totalmem > 2000.0 MB for 5 cycles then alert
   if loadavg(5min) greater than 4 for 8 cycles then alert
   group client_dev

The monitoring portion is running fine, no alerts yet (thankfully).  Given that there are no alerts, is it normal that my custom Service Group ('client_dev') doesn't show up in the Service Group drop-down menu in the Events page?  I'm almost tempted to force an alert just to see if it will show up but I figured I'd ask first ;)

Secondly, if you'll notice I am starting the program via "/bin/su -c '/path/to/start/script start -d'" with my /path/to/start/script being enclosed in single quotes.  Is this correct syntax?  Tempted to stop the process right now just to test but the site is under use as I type...

Any info / help is most greatly appreciated.


reply via email to

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