Changeset 4055


Ignore:
Timestamp:
11/19/13 13:53:31 (10 years ago)
Author:
sanmai
Message:
  • Fix port number parameter to httplib.HTTPConnection, to convert it to integer and

raise an error if that failed. It seems that when a string is passed for the 'port'
argument, no exception is raised by httplib, but irregular things happen such as
fictitious HTTP response codes being returned.

File:
1 edited

Legend:

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

    r4053 r4055  
    274274    #if authorize is None : authorize = True
    275275
     276    try:
     277        port_number = int(port_number)
     278    except ValueError :
     279        return { "code"      : "CRITICAL",
     280         "message"   : 'The port number specified, "{0}", cannot be converted to an integer.'.format(port_number)
     281       }
     282
    276283    def handle_connection_failure(problem_description) :
    277284        err_log_file_path = os.path.normpath("/tmp/" + special_plugin_file_name + "_err_connection_failure__" + http_path.replace('/' , '%2F') + "__" + timestamp + ".log")
     
    288295   
    289296    try :
     297        pdb.set_trace()
    290298        conn = httplib.HTTPConnection(host = host,
    291299                                      port = port_number,
     
    350358                    return {
    351359                              "code"      : "CRITICAL",
    352                               "message"   : 'Host %s is up but the response to GET "%s" implies an infinite redirection (to "%s").' % (host, http_path)
     360                              "message"   : 'Host %s is up but the response to GET "%s" implies an infinite redirection (to "%s").' % (host, http_path, http_path)
    353361                            }
    354362
Note: See TracChangeset for help on using the changeset viewer.