monit-general
[Top][All Lists]
Advanced

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

Re: test


From: Jan-Henrik Haukeland
Subject: Re: test
Date: Fri, 29 Aug 2003 17:52:57 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Civil Service, linux)

Igor Homyakov <address@hidden> writes:

> is it possible to check connection(s) without 
> checking process ?

Not as monit is now. Since monit is very localhost centric I guess we
(or at least I) simply haven't thought about this. 

But it is very easy to change this so a connection test may become a
standalone statement because all network code for doing this is
already in place. The only thing to change is the control file grammar
to allow such a standalone statement. From the top of my head, such a
statement may look like this:

 check host rhn.redhat.com:443 with type TCPSSL
  if failed connection with timeout 15 seconds then {..}
  if failed protocol http and request "/cgi-bin/login.cgi" then {..}
  alert address@hidden

But since we, right now, are in the process of releasing the monit 4.0
code as a beta and in a week as a full release I'm not sure we have
time to add this. But it is very tempting to do so :-)

What do others think? Is it interesting to add an external standalone
connection test to monit?


Ps. In a check process it is already possible to use an external
connection test like so (extracted from the presentation draft, see
paragraph 2 below):

 (1) check process apache with pidfile "/usr/local/apache/logs/httpd.pid"
 (2)    start = "/etc/init.d/httpd start"
 (3)    stop = "/etc/init.d/httpd stop"
 (4)    if failed port 80 and use the protocol http
 (5)                    and request "/cgi-bin/printenv" then restart
 (6)    if failed host weblogic.tildeslash.com port 8080 then alert
 (7)    if cpu usage is greater than 60 percent for 2 cycles then alert
 (8)    if cpu usage > 95% for 5 cycles then restart
 (9)    if 2 restarts within 3 cycles then timeout
(10)    alert address@hidden

Line 1 starts a process service entry. It contains the keyword check
and a descriptive name for the process to monitor, in this case
apache. Monit also requires each process to have a pidfile.  If you
want monit to start, stop or restart the process you must submit a
start and stop program. Line 2-3 defines those programs for this
process. In line 4 we ask monit to open a socket connection to the
apache server and request a certain document from the server at line
5. If this test fails, monit will restart the apache process. 

If you have setup apache to run as a front-end for an application
server on another machine you may also request monit to test the
connection to the application server and send an alert if the
connection should fail, line 6 contains such a test. You may also
specify the host name in a connection test to test name-based virtual
hosts at the web server.

Line 7-8 test the process characteristics and conduct an action if any
of the tests are true. In line 9 a timeout is set, i.e. if the process
was restarted X times within a period of Y poll cycles then monit will
not monitor this service anymore. The rationale for this is that monit
should not waste time trying to start or restart a service if it has
problems running stable. Finally in line 10 monit is requested to send
alert messages to address@hidden Monit will send alert messages for
events that occurred on the service, it is also possible to ask monit
only to send alerts for certain events.  We have only demonstrated a
few if-tests here, there are many more if-tests and other useful
statements you may use in a process service entry. See the
documentation.

-- 
Jan-Henrik Haukeland




reply via email to

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