monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Monit to monitor http process, not response code


From: Martin Pala
Subject: Re: [monit] Monit to monitor http process, not response code
Date: Thu, 15 May 2008 20:47:52 +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-5)

Yes, this could work ... alternatively you can use just the "alert" pair, since the process existence test is default and doesn't need any testing statement for being enabled.

The first "restart" pair will apply only in the case that the process is running but doesn't accept TCP connections (which can happen as well).

If the test failed, the response is not included in the mail currently (can be changed in future versions).


Martin



Chanchal James wrote:
I want to restart when the process doesnt exist. And alert if the response code is an error.

Thanks for the link. I reconfigured to do:

if failed host 127.0.0.1 <http://127.0.0.1> port 80
    then restart
if failed host 127.0.0.1 <http://127.0.0.1> port 443
    then restart

if failed host 127.0.0.1 <http://127.0.0.1> port 80 protocol http
    then alert
if failed host 127.0.0.1 <http://127.0.0.1> port 443 type tcpssl protocol http
    then alert
if 5 restarts within 5 cycles then timeout


Wont this do the job ? Is there a way to have the error code also included in email alert ?



On Wed, May 14, 2008 at 1:30 PM, Martin Pala <address@hidden <mailto:address@hidden>> wrote:

    if you don't want restart, then just replace the "restart" action
    with "alert" like this:

     if failed host 127.0.0.1 <http://127.0.0.1> <http://127.0.0.1> port
    443 type tcpssl
       protocol http
       then alert

    It is also possible to use send/expect statement to prepare custom
    protocol test. See monit manual for details
    (http://www.tildeslash.com/monit/doc/manual.php#connection_testing)

    Excerpt example from monit manual:

     if failed host cave.persia.ir <http://cave.persia.ir> port 4040
       send "Open, Sesame!\r\n"
       expect "Please enter the cave\r\n"
       send "Shut, Sesame!\r\n"
       expect "See you later [A-Za-z ]+\r\n"
     then alert


    Martin


    Chanchal James wrote:

        Hi,

        How can I have monit monitor http process without checking the
        http response code.

        Monit restarts http when index file is missing, because it
        throws 403 error. I would like it to restart http only when http
        process isnt running and probably report by mail if response
        code is an error(403, 500, 404 etc).


        My config is:

        check process apache with pidfile /usr/local/apache/logs/httpd.pid
        start program = "/etc/init.d/httpd start"
        stop program  = "/etc/init.d/httpd stop"
        if failed host 127.0.0.1 <http://127.0.0.1> <http://127.0.0.1>
        port 80 protocol http
           then restart
        if failed host 127.0.0.1 <http://127.0.0.1> <http://127.0.0.1>
        port 443 type tcpssl protocol http

           then restart
        if 5 restarts within 5 cycles then timeout
        group server


        Thanks for any help.


        ------------------------------------------------------------------------

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



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



------------------------------------------------------------------------

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




reply via email to

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