From: Guillaume Dargaud on
Hello all,
I have a webserver that sometimes hangs and I'd like a way to detect when
this happens.

Of course what I really want is to fix those lockups, but despite some
discussions on other forums and plenty of changes to my httpd.conf, no luck
so far. It's a recent apache, using php and mysql. The access_log file goes
on its merry way to report successful [200] requests, but seen from a
browser, they never finish. I applies to any request, even images, so it's
not a php problem.

Since this happens only about once a week, I'd like a script to detect it. I
was thinking of using wget to request a page, with some short timeout (say
30s), but reading the man page it seems that the various timeouts are for
other purposes. "... if, at any point in the download, no data is received
for more than the specified number of seconds, reading fails and the
download is restarted...". Maybe with -r 0 ?

What do you think ? Is there a better way to do it ?
--
Guillaume Dargaud
http://www.gdargaud.net/


From: Thomas 'PointedEars' Lahn on
Guillaume Dargaud wrote:

> I have a webserver that sometimes hangs and I'd like a way to detect when
> this happens.
>
> Of course what I really want is to fix those lockups, but despite some
> discussions on other forums and plenty of changes to my httpd.conf, no
> luck so far. It's a recent apache, using php and mysql. The access_log
> file goes on its merry way to report successful [200] requests, but seen
> from a browser, they never finish.

If you see the HTTP requests in the log, they "have finished". It is the
HTTP *responses* that you have a problem with. That said, you could be
haunted by a crawler; a robots.txt may help then.

> I applies to any request, even images, so it's not a php problem.

That is a fallacy. A Web server can be (mis)configured to have PHP process
every requested resource before it is served.

> Since this happens only about once a week, I'd like a script to detect it.
> I was thinking of using wget to request a page, with some short timeout
> (say 30s), but reading the man page it seems that the various timeouts are
> for other purposes. "... if, at any point in the download, no data is
> received for more than the specified number of seconds, reading fails and
> the download is restarted...". Maybe with -r 0 ?
>
> What do you think ?

wget(1) will probably not reveal the problem.

> Is there a better way to do it ?

You need to do a more thorough analysis of the problem; include the Apache
error log, the system log, root's mailbox and the crontab (e.g. look for
expensive cron jobs), and network logs.

This newsgroup, comp.unix.shell (tagline: "Using and programming the Unix
shell"), is the wrong place to ask about wget(1) features, and for a
solution to this problem.

<http://www.catb.org/~esr/faqs/smart-questions.html>


PointedEars
From: Guillaume Dargaud on

> This newsgroup, comp.unix.shell (tagline: "Using and programming the Unix
> shell"), is the wrong place to ask about wget(1) features, and for a
> solution to this problem.

I kinda knew it was OT, but thanks for the pointers, I'll look into it.
--
Guillaume Dargaud
http://www.gdargaud.net/