Question Details

Browse

Making sure apache is up and running

By gsunny - Apr. 06, 2008

Am curious to know how you monitor whether your apache server is running. Am looking for thoughts here, and perhaps some examples of what has worked and what has not. Should I ping the server? Should I request an html file? Should I check the httpd process? Should I stat the log file? Any best practices here?

TIA.


Answers

Add Answer
  1. By dvershinin on Apr. 08, 2008

    I haven't used anything for purpose of checking that apache is running. But I believe there are already many desktop applications to monitor web server.

    This kind of application is easy to write with the following idea:

    On the server you create a php script page with "known" output.

    The desktop application then would just send GET request for the php page and check that the output is correct.

    Thus, it does two things:

    1) if no page returned or GET returns HTTP error code, means apache is down / something is wrong in configuration

    2) if the php output is not what expected, something is wrong with php configuration


    0 Votes
  2. By Moskit on Apr. 08, 2008

    The best practice is to use all possible methods :) Checking the httpd process, for example, is not enough to understand if httpd is really doing its work, but it is necessary to know if it is running if external tests show that something goes wrong.

    I would recommend to use curl for external monitoring (exact syntax depends on your website, if it has https, authentication etc etc).

    For internal monitoring I use the command:

    netstat -tulpn | grep -vE '^Active|Proto'

    which outputs all running services along with their ports (httpd is not the only service that needs monitoring!). Monitoring script analyzes the result then and send a message if something wrong.


    0 Votes
  3. By leehj2008 on Sep. 01, 2008

    netstat -a -o


    0 Votes
  4. By qiandonghui on Sep. 01, 2008

    netstat -a check the port


    0 Votes
  5. By Frenzy on Sep. 02, 2008

    Very simple but working way: use telnet (like telnet google.com http) to send any http-request to your server, if it responds with html or something then your server is surely up and running.


    0 Votes
  6. By farleym on Sep. 04, 2008

    you can use a text based browser to enable automated checking or a program where you can check the http server's response code or timeout if there is a problem. Or if you are trying to validate that part of the site is functioning even when the the web server is up and running you can use the responding page html to check for a particular string that would only be there when there are no errors.


    0 Votes
Share your knowledge

Related Questions

Browse Get answers and share your expertise.