#!/usr/bin/python2 import generic_tla_monitoring import os, pdb special_plugin_description = "OAI-PMH endpoint" special_plugin_file_name = os.path.basename(__file__) OAI_namespace = "http://www.openarchives.org/OAI/2.0/" command_line_parameters = [("-s", "scheme"), ("-h", "host",), ("-u", "http_path",), ("-p", "port_number",)] def special_main_subroutine(scheme, host, http_path, port_number) : http_paths = (http_path,) # X- use frozenset ## Warning: check of validity of returned data relies on the XML namespace OAI_NAMESPACE of the returned XML markup. valid_root_element_tag = "{%s}OAI-PMH" % (OAI_namespace) ## Check status for all http_paths. results = \ map(lambda http_path : generic_tla_monitoring.check_condition(host = host, http_path = http_path, HTTP_method = 'GET', protocol = scheme, port_number = port_number, authorize = True, validator = generic_tla_monitoring.check_XML_validity, valid_root_element_tag = valid_root_element_tag, special_plugin_file_name = special_plugin_file_name), http_paths) generic_tla_monitoring.nagios_return_complex(results, reporter = special_plugin_description) if __name__ == "__main__" : generic_tla_monitoring.main(special_main_subroutine, command_line_parameters)