source: monitoring/plugins/mpi/check_lat_handle.py

Last change on this file was 4057, checked in by sanmai, 11 years ago
  • Make protocol/scheme (http, https) a command-line parameter and an internal

parameter. Fixes redirects from http URLs to https URLs and vice versa.

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/usr/bin/python2
2
3import generic_tla_monitoring
4import os, pdb
5
6
7special_plugin_description = "Handle"
8special_plugin_file_name = os.path.basename(__file__)
9command_line_parameters = [("-s", "scheme"), 
10                           ("-h", "host",),
11                           ("-u", "http_path",),
12                           ("-p", "port_number",)]
13IMDI_namespace = "http://www.mpi.nl/IMDI/Schema/IMDI"
14
15# Warning: old checking condition "if 300 <= r1.status and r1.status < 400:" X-
16
17def special_main_subroutine(scheme, 
18                            host, 
19                            http_path,
20                            port_number) : 
21
22    valid_root_element_tag = "{%s}METATRANSCRIPT" % (IMDI_namespace)
23
24    http_paths = (http_path,) # X- use frozenset
25   
26    ## Check status for all http_paths.
27    results = \
28        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host, ## Always hdl.handle.net
29                                                                      http_path                 = http_path, 
30                                                                      protocol                  = scheme, 
31                                                                      HTTP_method               = 'POST', 
32                                                                      port_number               = port_number, 
33                                                                      authorize                 = True, 
34                                                                      validator                 = generic_tla_monitoring.check_XML_validity,
35                                                                      valid_root_element_tag    = valid_root_element_tag,                                                                 
36                                                                      special_plugin_file_name  = special_plugin_file_name),
37                           http_paths)   
38   
39    generic_tla_monitoring.nagios_return_complex(results, reporter = special_plugin_description)
40
41if __name__ == "__main__" :
42    generic_tla_monitoring.main(special_main_subroutine, 
43                                command_line_parameters)
44
Note: See TracBrowser for help on using the repository browser.