how best to handle httplib timeouts ?

Discussion in 'Python' started by Rich, Jul 30, 2003.

  1. Rich

    Rich Guest

    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
    Rich, Jul 30, 2003
    #1
    1. Advertising

  2. 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
    Skip Montanaro, Jul 30, 2003
    #2
    1. Advertising

  3. Rich

    Rich Guest

    "Skip Montanaro" <> wrote in message
    news:...
    >
    > 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
    >

    Thanks Skip,
    Monitoring services themselves is a snap but I'm trying to monitor the state
    of IIS, and in particular the state of OWA running on IIS. OWA for Exchange
    5.5 is a bit flakey at best and it doesn't always show up as a service
    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)

    thanks,

    rich.
    Rich, Jul 30, 2003
    #3
  4. Rich

    Rich Guest

    "John J. Lee" <> wrote in message
    news:...
    >

    [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.
    Rich, Jul 31, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmFzb24=?=

    forms authentication timeouts and session timeouts

    =?Utf-8?B?SmFzb24=?=, Jun 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    437
    =?Utf-8?B?SmFzb24=?=
    Jun 22, 2004
  2. Shagshag
    Replies:
    0
    Views:
    494
    Shagshag
    Apr 1, 2004
  3. Michael Ekstrand
    Replies:
    0
    Views:
    326
    Michael Ekstrand
    Aug 8, 2005
  4. Henk Van Lingen
    Replies:
    0
    Views:
    99
    Henk Van Lingen
    Jul 23, 2009
  5. 9.co.uk
    Replies:
    2
    Views:
    143
    9.co.uk
    Mar 1, 2008
Loading...

Share This Page