source: monitoring/plugins/mpi/check_lat_oai_endpoint.py @ 3555

Last change on this file since 3555 was 3555, checked in by sanmai, 11 years ago
  • Add plugin for LAT PostgreSQL server.
  • Rework generic HTTP check to allow port number specification.
  • Some renaming/clarification.
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/usr/bin/python2
2
3import generic_tla_monitoring
4import os, pdb
5
6
7special_plugin_description = "OAI-PMH endpoint"
8special_plugin_file_name = os.path.basename(__file__)
9OAI_namespace = "http://www.openarchives.org/OAI/2.0/"
10command_line_parameters = [("-h", "host",),
11                           ("-u", "http_path",)]
12
13# Warning: check of validity of returned data relies on the XML namespace OAI_NAMESPACE of the returned XML markup.
14
15def special_main_subroutine(host, 
16                            http_path) :
17
18    http_paths = (http_path,) # X- use frozenset
19
20    valid_root_element_tag  = "{%s}OAI-PMH" % (OAI_namespace)
21   
22    # Check status for all http_paths.
23    results = \
24        map(lambda http_path : generic_tla_monitoring.check_condition(host                      = host,
25                                                                      http_path                 = http_path,
26                                                                      HTTP_method               = 'GET',
27                                                                      port_number               = 80,
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),
32            http_paths)   
33   
34    generic_tla_monitoring.nagios_return_complex(results, reporter = special_plugin_description)
35
36if __name__ == "__main__" :
37    generic_tla_monitoring.main(special_main_subroutine, 
38                                command_line_parameters)
Note: See TracBrowser for help on using the repository browser.