Changeset 4049 for monitoring


Ignore:
Timestamp:
11/19/13 13:04:40 (11 years ago)
Author:
sanmai
Message:
  • Fix infinite loop in case of HTTP redirect to itself.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • monitoring/plugins/mpi/generic_tla_monitoring.py

    r4047 r4049  
    288288   
    289289    try :
    290         conn = httplib.HTTPConnection(host = host, port = port_number) # X- accomodate https?
    291 
    292         request = conn.request(HTTP_method, http_path)
     290        conn = httplib.HTTPConnection(host = host,
     291                                      port = port_number
     292                                      strict = True) # X- accomodate https?
     293
     294        request = conn.request(HTTP_method,
     295                               http_path)
    293296    except :
    294297        traceback_string = traceback.format_exc()
     
    323326            # HTTP status codes 200 and 302
    324327            # X- Resolve redirect in case of HTTP status == 302
    325                 well_formed = validator(data                    = data,
     328                well_formed = validator(data                   = data,
    326329                                        descriptive_string     = http_path,
    327330                                        **validator_arguments) # ['validator_arguments'])
     
    344347
    345348               
    346 
    347                 return check_condition(host        = parsed_new_location_URL.netloc,
    348                                        http_path   = parsed_new_location_URL.path,
    349                                        HTTP_method = HTTP_method,
    350                                        port_number = port_number,
    351                                        authorize   = authorize,
    352                                        validator   = validator,
    353                                        **validator_arguments) # special_plugin_file_name = validator_arguments['special_plugin_file_name']
     349                if host == parsed_new_location_URL and http_path == parsed_new_location_URL :
     350                    return {
     351                              "code"      : "CRITICAL",
     352                              "message"   : 'Host %s is up but the response to GET "%s" implies an infinite redirection (to "%s").' % (host, http_path)
     353                            }
     354
     355                else : 
     356
     357                    return check_condition(host        = parsed_new_location_URL.netloc,
     358                                           http_path   = parsed_new_location_URL.path,
     359                                           HTTP_method = HTTP_method,
     360                                           port_number = port_number,
     361                                           authorize   = authorize,
     362                                           validator   = validator,
     363                                           **validator_arguments) # special_plugin_file_name = validator_arguments['special_plugin_file_name']
    354364
    355365            elif response.status == httplib.UNAUTHORIZED and authorize == False :
Note: See TracChangeset for help on using the changeset viewer.