FAQ
Hi all,

I'm trying to write an app to monitor an IIS server, by connecting and
getting a page via httplib. the problem seems to be when IIS (or ASP) dies
httplib does not always return and sometimes I'm left with an app that
hangs. what is the best way to handle this ?

thanks,
rich.

the code looks like this:

try:
res = h.getresponse()
dat = res.read()
sFlag = sFlag + 1
except:
if debug > 0:
WriteLog(' Error receiving a response from 2nd mailbox page
request')
h.close()
return sFlag

Search Discussions

  • John J. Lee at Jul 30, 2003 at 11:23 am
    "Rich" <rich at mchsi.com> writes:
    [...]
    getting a page via httplib. the problem seems to be when IIS (or ASP) dies
    httplib does not always return and sometimes I'm left with an app that
    hangs. what is the best way to handle this ?
    [...]

    2.3 has timeout support for sockets (but not for DNS, IIRC).


    John
  • Skip Montanaro at Jul 30, 2003 at 1:21 pm
    rich> I'm trying to write an app to monitor an IIS server, .... what is
    rich> the best way to handle this ?

    Off-topic response perhaps, but if you want to monitor services running on
    remote machines, you should see what's already available. I use Nagios,
    <http://www.nagios.org/>, and find it excellent for the purpose (a bit
    complex to get started with, but very robust).

    Skip
  • John J. Lee at Jul 30, 2003 at 5:52 pm
    "Rich" <rich at mchsi.com> writes:
    [...]
    outage. The script I have so far connects to the server (using HTTPS) then
    passes a login request for a mailbox and retrieves the Inbox page. It does 5
    different requests in all and sometimes gets stuck on the third or fourth
    request. Running the source code version seems a little better than the one
    compiled with py2exe, and it will often return after what seems like a 2
    minute socket timeout. I've also tried playing with different settings for
    the default socket timeout value but that doesn't seem to help either. (I'm
    running 2.3b2)
    1. Get 2.3final (I don't know whether there was a bug fix, but I have
    a vague recollection there was some sort of problem with timeouts
    -- see the python-dev summaries and/or SF bug archive).

    2. Check with a tool like ethereal to see exactly where it's getting
    stuck. If it's DNS, maybe you can do the name lookup(s) once, then
    just use the IP address for subsequent requests. If not, at least
    you'll know where the problem is.


    John
  • Rich at Jul 31, 2003 at 2:41 am
    "John J. Lee" <jjl at pobox.com> wrote in message
    news:87k79zx5q6.fsf at pobox.com...
    >
    [snip]
    1. Get 2.3final (I don't know whether there was a bug fix, but I have
    a vague recollection there was some sort of problem with timeouts
    -- see the python-dev summaries and/or SF bug archive).
    yes, this seems to have made the problem go away... I tried setting the
    default timeout but it still acted flakey and would not connect, so, I
    removed this and everything seems to be working, or at lest timing out
    correctly.

    2.3final also solved the "ImportError: No module named warnings" problem
    with py2exe and I think this may have had something to do with it.

    thanks,
    rich.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJul 30, '03 at 3:58a
activeJul 31, '03 at 2:41a
posts5
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase