Changeset 4060 for monitoring
- Timestamp:
- 11/19/13 16:46:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
monitoring/plugins/mpi/generic_tla_monitoring.py
r4058 r4060 276 276 #if authorize is None : authorize = True 277 277 278 try :278 try : 279 279 port_number = int(port_number) 280 280 except ValueError : … … 282 282 "message" : 'The port number specified, "{0}", cannot be converted to an integer.'.format(port_number) 283 283 } 284 except TypeError : 285 port_number = None 284 286 285 287 def handle_connection_failure(problem_description) : … … 302 304 strict = True) 303 305 elif protocol == 'https' : 306 307 304 308 conn = httplib.HTTPSConnection(host = host, 305 309 port = port_number, … … 314 318 return { 315 319 "code" : "CRITICAL", 316 "message" : 'HTTP connection to host %s failed.' % (host) 320 "message" : '{protocol} connection on port {port_number} to host "{host}" failed.'.format(protocol = protocol, 321 port_number = port_number, 322 host = host) 317 323 } 318 324 else : … … 344 350 345 351 if well_formed : 352 346 353 return { 347 354 "code" : "OK", 348 "message" : 'Host %s is up and returns well-formed data at "%s".' % (host,http_path)355 "message" : 'Host "{host}" is up and returns well-formed data at "{http_path}".'.format(host = host, http_path = http_path) 349 356 } 350 357 else : 351 358 return { 352 359 "code" : "CRITICAL", 353 "message" : 'Host %s is up but returns non-well-formed data at "%s".' % (host,http_path)360 "message" : 'Host "{host}" is up but returns non-well-formed data at "{http_path}".'.format(host = host, http_path = http_path) 354 361 } 355 362 … … 357 364 new_location_URL = dict(response.getheaders())['location'] 358 365 359 parsed_new_location_URL = urlparse.urlparse(new_location_URL) 366 parsed_new_location_URL = urlparse.urlsplit(new_location_URL) 367 new_http_path = parsed_new_location_URL.path 368 if parsed_new_location_URL.query != '' : 369 new_http_path = new_http_path + '?' + parsed_new_location_URL.query 360 370 361 if parsed_new_location_URL.scheme == protocol and host == parsed_new_location_URL.netloc and http_path == parsed_new_location_URL.path :371 if parsed_new_location_URL.scheme == protocol and host == parsed_new_location_URL.netloc and http_path == new_http_path : 362 372 return { 363 "code" 364 "message" : 'Host %s is up but the response to GET "%s" implies an infinite redirection (to "%s").' % (host, http_path,http_path)373 "code" : "CRITICAL", 374 "message" : 'Host "{host}" is up but the response to GET "{http_path}" implies an infinite redirection to itself.'.format(host = host, http_path = http_path) 365 375 } 366 376 367 else : 377 else : 378 379 pdb.set_trace() 368 380 369 381 return check_condition(host = parsed_new_location_URL.netloc, 370 http_path = parsed_new_location_URL.path,382 http_path = new_http_path, 371 383 protocol = parsed_new_location_URL.scheme, 372 384 HTTP_method = HTTP_method, 373 port_number = p ort_number,385 port_number = parsed_new_location_URL.port, 374 386 authorize = authorize, 375 387 validator = validator, … … 379 391 return { 380 392 "code" : "OK", 381 "message" : 'Host %s is up and requests authorization at "%s".' % (host,http_path)393 "message" : 'Host "{host}" is up and requests authorization at "{http_path}".'.format(host = host, http_path = http_path) 382 394 } 383 395 … … 389 401 return { 390 402 "code" : "CRITICAL", 391 "message" : 'Host %s has a problem with the URL path component "%s".' % (host,http_path)403 "message" : 'Host "{host}" has a problem with the URL path component "{http_path}}".'.format(host = host, http_path = http_path) 392 404 } 393 405
Note: See TracChangeset
for help on using the changeset viewer.