Changeset 4057 for monitoring


Ignore:
Timestamp:
11/19/13 16:11:03 (11 years ago)
Author:
sanmai
Message:
  • Make protocol/scheme (http, https) a command-line parameter and an internal

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

Location:
monitoring/plugins/mpi
Files:
17 edited

Legend:

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

    r4047 r4057  
    88special_plugin_file_name = os.path.basename(__file__)
    99
    10 command_line_parameters = [("-h", "host",),
    11                            ("-u", "URL",),
     10command_line_parameters = [("-s", "scheme"),
     11                           ("-h", "host",),
     12                           ("-u", "http_path",),
    1213                           ("-p", "port",)]
    1314
    1415
    15 def special_main_subroutine(host,
     16def special_main_subroutine(scheme,
     17                            host,
    1618                            http_path,
    17                             port_number) :
     19                            port_number) : 
    1820
    1921    http_paths = (http_path,) # X- use frozenset
  • monitoring/plugins/mpi/check_clarin_discojuice_html.py

    r4047 r4057  
    77special_plugin_description = "Discojuice HTML"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
    10                            ("-u", "URL",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
     11                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
    1213
    1314
    14 def special_main_subroutine(host,
     15def special_main_subroutine(scheme,
     16                            host,
    1517                            http_path,
    16                             port_number) :
     18                            port_number) : 
    1719
    1820    http_paths = (http_path,)
  • monitoring/plugins/mpi/check_clarin_discojuice_json.py

    r4047 r4057  
    77special_plugin_description = "Discojuice JSON"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
    1213
    13 
    14 def special_main_subroutine(host,
     14def special_main_subroutine(scheme,
     15                            host,
    1516                            http_path,
    16                             port_number) :
     17                            port_number) : 
    1718
    1819    http_paths = (http_path,)
  • monitoring/plugins/mpi/check_clarin_vlo.py

    r4047 r4057  
    77special_plugin_file_name = os.path.basename(__file__)
    88
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
    1213
    13 def special_main_subroutine(host,
     14def special_main_subroutine(scheme,
     15                            host,
    1416                            http_path,
    1517                            port_number) :
     
    2123        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host,
    2224                                                                      http_path                 = http_path,
     25                                                                      protocol                  = scheme,
    2326                                                                      HTTP_method               = "GET",
    2427                                                                      port_number               = port_number,
  • monitoring/plugins/mpi/check_lat_annex.py

    r4047 r4057  
    77special_plugin_description = "Annex"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
    1213
    1314
    14 def special_main_subroutine(host,
     15def special_main_subroutine(scheme,
     16                            host,
    1517                            http_path,
    1618                            port_number) :
     
    2123    results = \
    2224        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host,
    23                                                                       http_path                 = http_path,
     25                                                                      http_path                 = http_path,
     26                                                                      protocol                  = scheme,
    2427                                                                      HTTP_method               = "GET",
    2528                                                                      port_number               = port_number,
  • monitoring/plugins/mpi/check_lat_avatech_clam.py

    r4048 r4057  
    77special_plugin_description = "AVATecH CLAM"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
     
    2021    ## Check status for all http_paths.
    2122    results = \
    22         map(lambda http_path : generic_tla_monitoring.check_condition(host                   = host,
    23                                                                    http_path                 = http_path,
    24                                                                    HTTP_method               = "GET",
    25                                                                    port_number               = port_number,
    26                                                                    authorize                 = True,
    27                                                                    validator                 = generic_tla_monitoring.check_XML_validity,
    28                                                                    valid_root_element_tag    = valid_root_element_tag,
    29                                                                    special_plugin_file_name  = special_plugin_file_name),
     23        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host,
     24                                                                      http_path                 = http_path,
     25                                                                      protocol                  = scheme,
     26                                                                      HTTP_method               = "GET",
     27                                                                      port_number               = port_number,
     28                                                                      authorize                 = True,
     29                                                                      validator                 = generic_tla_monitoring.check_XML_validity,
     30                                                                      valid_root_element_tag    = valid_root_element_tag,
     31                                                                      special_plugin_file_name  = special_plugin_file_name),
    3032          http_paths)   
    3133   
  • monitoring/plugins/mpi/check_lat_cql_endpoint.py

    r4047 r4057  
    88special_plugin_file_name = os.path.basename(__file__)
    99CQL_namespace = "http://www.loc.gov/zing/srw/"
    10 command_line_parameters = [("-h", "host",),
     10command_line_parameters = [("-s", "scheme"),
     11                           ("-h", "host",),
    1112                           ("-u", "http_path",),
    1213                           ("-p", "port_number",)]
    1314
    1415
    15 def special_main_subroutine(host,
     16def special_main_subroutine(scheme,
     17                            host,
    1618                            http_path,
    1719                            port_number) :
     
    2628        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host,
    2729                                                                      http_path                 = http_path,
     30                                                                      protocol                  = scheme,
    2831                                                                      HTTP_method               = 'GET',
    2932                                                                      port_number               = port_number,
  • monitoring/plugins/mpi/check_lat_dobes.py

    r4047 r4057  
    77special_plugin_description = "DoBeS"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
    1213
    1314
    14 def special_main_subroutine(host,
     15def special_main_subroutine(scheme,
     16                            host,
    1517                            http_path,
    1618                            port_number) :
  • monitoring/plugins/mpi/check_lat_handle.py

    r4047 r4057  
    77special_plugin_description = "Handle"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
     
    1415# Warning: old checking condition "if 300 <= r1.status and r1.status < 400:" X-
    1516
    16 def special_main_subroutine(host,
     17def special_main_subroutine(scheme,
     18                            host,
    1719                            http_path,
    1820                            port_number) :
     
    2628        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host, ## Always hdl.handle.net
    2729                                                                      http_path                 = http_path,
     30                                                                      protocol                  = scheme,
    2831                                                                      HTTP_method               = 'POST',
    2932                                                                      port_number               = port_number,
  • monitoring/plugins/mpi/check_lat_imdi.py

    r4047 r4057  
    77special_plugin_description = "IMDI browser"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
    1213
    13 def special_main_subroutine(host,
     14def special_main_subroutine(scheme,
     15                            host,
    1416                            http_path,
    15                             port_number) :
     17                            port_number) : 
    1618
    1719    http_paths = (http_path,)
     
    2426    ## Check status for all http_paths.
    2527    results = \
    26         map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host,
    27                                                                       http_path                 = http_path,
    28                                                                       HTTP_method               = 'GET',
    29                                                                       port_number               = port_number,
    30                                                                       authorize                 = True,
     28        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host,
     29                                                                      http_path                 = http_path,
     30                                                                      protocol                  = scheme,
     31                                                                      HTTP_method               = 'GET',
     32                                                                      port_number               = port_number,
     33                                                                      authorize                 = True,
    3134                                                                      validator                 = generic_tla_monitoring.check_HTML_wellformedness,
    3235                                                                      special_plugin_file_name  = special_plugin_file_name),
  • monitoring/plugins/mpi/check_lat_lamus.py

    r4047 r4057  
    77special_plugin_description = "Lamus"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
    1213
    1314
    14 def special_main_subroutine(host,
     15def special_main_subroutine(scheme,
     16                            host,
    1517                            http_path,
    1618                            port_number) :
     
    2224        map(lambda http_path : generic_tla_monitoring.check_condition(host                     = host,
    2325                                                                      http_path                = http_path,
     26                                                                      protocol                 = scheme,
    2427                                                                      HTTP_method              = 'GET',
    2528                                                                      port_number              = port_number,
  • monitoring/plugins/mpi/check_lat_lexus.py

    r4047 r4057  
    77special_plugin_description = "Lexus"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
    1213
    1314
    14 def special_main_subroutine(host,
     15def special_main_subroutine(scheme,
     16                            host,
    1517                            http_path,
    1618                            port_number) :
     
    2224        map(lambda http_path : generic_tla_monitoring.check_condition(host                     = host,
    2325                                                                      http_path                = http_path,
     26                                                                      protocol                 = scheme,
    2427                                                                      HTTP_method              = 'GET',
    2528                                                                      port_number              = port_number,
  • monitoring/plugins/mpi/check_lat_oai_endpoint.py

    r4047 r4057  
    88special_plugin_file_name = os.path.basename(__file__)
    99OAI_namespace = "http://www.openarchives.org/OAI/2.0/"
    10 command_line_parameters = [("-h", "host",),
     10command_line_parameters = [("-s", "scheme"),
     11                           ("-h", "host",),
    1112                           ("-u", "http_path",),
    1213                           ("-p", "port_number",)]
     
    2728                                                                      http_path                 = http_path,
    2829                                                                      HTTP_method               = 'GET',
     30                                                                      protocol                  = scheme,
    2931                                                                      port_number               = port_number,
    3032                                                                      authorize                 = True,
  • monitoring/plugins/mpi/check_lat_postgresql.py

    r4047 r4057  
    77special_plugin_description = "LAT PostgreSQL database server"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number")]
    1213
    1314
    14 def special_main_subroutine(host,
    15                             http_path,
     15def special_main_subroutine(scheme,
     16                            host,
     17                            http_path,
    1618                            port_number) :
    1719
     
    2224        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host,
    2325                                                                      http_path                 = http_path,
     26                                                                      protocol                  = scheme,
    2427                                                                      HTTP_method               = "GET",
    2528                                                                      port_number               = port_number,
  • monitoring/plugins/mpi/check_lat_www.py

    r4047 r4057  
    77special_plugin_description = "TLA WWW"
    88special_plugin_file_name = os.path.basename(__file__)
    9 command_line_parameters = [("-h", "host",),
     9command_line_parameters = [("-s", "scheme"),
     10                           ("-h", "host",),
    1011                           ("-u", "http_path",),
    1112                           ("-p", "port_number",)]
    1213
    1314
    14 def special_main_subroutine(host,
     15def special_main_subroutine(scheme,
     16                            host,
    1517                            http_path,
    1618                            port_number) :
     
    2224        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host,
    2325                                                                      http_path                 = http_path,
     26                                                                      protocol                  = scheme,
    2427                                                                      HTTP_method               = "GET",
    2528                                                                      port_number               = port_number,
  • monitoring/plugins/mpi/generic_tla_monitoring.py

    r4056 r4057  
    261261    return result
    262262
     263
    263264def check_condition(host,
    264                     http_path,
     265                    http_path,
     266                    protocol,
    265267                    HTTP_method,
    266268                    port_number,
     
    294296    timestamp = datetime.datetime.today().isoformat()
    295297   
    296     try :
    297         conn = httplib.HTTPConnection(host = host,
    298                                       port = port_number,
    299                                       strict = True) # X- accomodate https?
    300 
     298    try :
     299        if protocol = 'http' :
     300            conn = httplib.HTTPConnection(host = host,
     301                                          port = port_number,
     302                                          strict = True)
     303        elif protocol = 'https' :
     304            conn = httplib.HTTPSConnection(host = host,
     305                                           port = port_number,
     306                                           strict = True)
    301307        request = conn.request(HTTP_method,
    302308                               http_path)
     
    352358
    353359                parsed_new_location_URL = urlparse.urlparse(new_location_URL)
    354 
    355360               
    356                 if host == parsed_new_location_URL.netloc and http_path == parsed_new_location_URL.path :
     361                if parsed_new_location_URL.scheme == protocol and host == parsed_new_location_URL.netloc and http_path == parsed_new_location_URL.path :
    357362                    return {
    358363                              "code"      : "CRITICAL",
     
    364369                    return check_condition(host        = parsed_new_location_URL.netloc,
    365370                                           http_path   = parsed_new_location_URL.path,
     371                                           protocol    = parsed_new_location_URL.scheme,
    366372                                           HTTP_method = HTTP_method,
    367373                                           port_number = port_number,
  • monitoring/plugins/mpi/plugins_hosts_services.tab

    r4047 r4057  
    1 file name       description     -h      protocol        -u      -b      -d      -p
    2 check_lat_cql_endpoint.py       CQL endpoint    cqlservlet.mpi.nl       http    '/'                     80
    3 check_lat_avatech_clam.py       AVATecH CLAM    catalog.clarin.eu       http    '/avatech/avatech_iais_fine_segmentation'                       80
    4 check_lat_lexus.py      Lexus   corpus1.mpi.nl  http    '/mpi/lexusDojo/'                       80
    5 check_lat_lamus.py      Lamus   corpus1.mpi.nl  http    '/jkc/lamus/lamusstart.jsp'                     80
    6 check_lat_imdi.py       IMDI browser [staging]  lux17.mpi.nl    http    '/ds/imdi_browser/viewcontroller?request=view&nodeid=MPI299144%23'                      80
    7 check_lat_imdi.py       IMDI browser [production]       corpus1.mpi.nl  http    '/ds/imdi_browser/viewcontroller?request=view&nodeid=MPI299144%23'                      80
    8 check_lat_handle.py     Handle  hdl.handle.net  http    '/?hdl=1839%2F00-0000-0000-0000-0000-4&auth=x'                  80
    9 check_lat_annex.py      Annex   corpus1.mpi.nl  http    '/ds/annex/runLoader?nodeid=MPI600401%23'                       80
    10 check_lat_oai_endpoint.py       OAI-PMH corpus1.mpi.nl  http    '/ds/oaiprovider/oai2?verb=Identify'                    80
    11 check_clarin_saml.py    SAML    infra.clarin.eu https   '/aai/clarin-sp-metadata.xml'           /srv/www/infra.clarin.eu/       80
    12 check_clarin_discojuice_html.py Discojuice HTML 1       catalog.clarin.eu       http    '/mw1/sds/discojuice'                   80
    13 check_clarin_discojuice_html.py Discojuice HTML 2       catalog.clarin.eu       http    '/mw2/sds/discojuice'                   
    14 check_clarin_discojuice_json.py Discojuice JSON 1       catalog.clarin.eu       http    '/discojuice/metadata_clarin1.json'                     80
    15 check_clarin_discojuice_json.py Discojuice JSON 2       catalog.clarin.eu       http    '/discojuice/metadata_clarin2.json'                     80
    16 check_clarin_vlo.py     Virtual Language Observatory    catalog.clarin.eu       http    '/vlo/'                 
    17 check_clarin_comp_reg.py        Component Registry      catalog.clarin.eu       http    '/ds/ComponentRegistry/'                        80
    18 check_clarin_ldap.py    LDAP directory  user.clarin.eu  ldap            'cn=Directory Manager'          80
    19 check_lat_dobes.py      DoBeS   dobes.mpi.nl    http    '/'                     80
    20 check_lat_postgresql.py LAT PostgreSQL database server  lux08.mpi.nl    http    '/rest/'                        8984
     1file name       description     -s      -h      -u      -b      -d      -p
     2check_lat_cql_endpoint.py       http    CQL endpoint    cqlservlet.mpi.nl       '/'                     80
     3check_lat_avatech_clam.py       http    AVATecH CLAM    catalog.clarin.eu       '/avatech/avatech_iais_fine_segmentation'                       80
     4check_lat_lexus.py      Lexus   http    corpus1.mpi.nl  '/mpi/lexusDojo/'                       80
     5check_lat_lamus.py      Lamus   http    corpus1.mpi.nl  '/jkc/lamus/lamusstart.jsp'                     80
     6check_lat_imdi.py       IMDI browser [staging]  http    lux17.mpi.nl    '/ds/imdi_browser/viewcontroller?request=view&nodeid=MPI299144%23'                      80
     7check_lat_imdi.py       IMDI browser [production]       http    corpus1.mpi.nl  '/ds/imdi_browser/viewcontroller?request=view&nodeid=MPI299144%23'                      80
     8check_lat_handle.py     Handle  http    hdl.handle.net  '/?hdl=1839%2F00-0000-0000-0000-0000-4&auth=x'                  80
     9check_lat_annex.py      Annex   http    corpus1.mpi.nl  '/ds/annex/runLoader?nodeid=MPI600401%23'                       80
     10check_lat_oai_endpoint.py       OAI-PMH http    corpus1.mpi.nl  '/ds/oaiprovider/oai2?verb=Identify'                    80
     11check_clarin_saml.py    SAML    https   infra.clarin.eu '/aai/clarin-sp-metadata.xml'           /srv/www/infra.clarin.eu/       80
     12check_clarin_discojuice_html.py Discojuice HTML 1       http    catalog.clarin.eu       '/mw1/sds/discojuice'                   80
     13check_clarin_discojuice_html.py Discojuice HTML 2       http    catalog.clarin.eu       '/mw2/sds/discojuice'                   
     14check_clarin_discojuice_json.py Discojuice JSON 1       http    catalog.clarin.eu       '/discojuice/metadata_clarin1.json'                     80
     15check_clarin_discojuice_json.py Discojuice JSON 2       http    catalog.clarin.eu       '/discojuice/metadata_clarin2.json'                     80
     16check_clarin_vlo.py     Virtual Language Observatory    http    catalog.clarin.eu       '/vlo/'                 
     17check_clarin_comp_reg.py        Component Registry      http    catalog.clarin.eu       '/ds/ComponentRegistry/'                        80
     18check_clarin_ldap.py    LDAP directory  http    user.clarin.eu  ldap            'cn=Directory Manager'          80
     19check_lat_dobes.py      DoBeS   http    dobes.mpi.nl    http    '/'                     80
     20check_lat_postgresql.py LAT PostgreSQL database server  http    lux08.mpi.nl    '/rest/'                        8984
Note: See TracChangeset for help on using the changeset viewer.