Changeset 3304
- Timestamp:
- 08/08/13 08:51:08 (11 years ago)
- Location:
- monitoring/plugins/mpi
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
monitoring/plugins/mpi/check_clarin_saml.py
r3243 r3304 10 10 11 11 DESCRIPTION = "SAML" 12 CLARIN_server_root_directory_path = "/srv/www/infra.clarin.eu" 12 #CLARIN_server_root_directory_path = "/srv/www/infra.clarin.eu/" 13 command_line_parameters = [("-h", "host",), 14 ("-u", "URL"), 15 ("-d", "infra.clarin.eu root directory path",)] 13 16 14 17 nagios_codes = { … … 19 22 'DEPENDENT' : 4 20 23 } 21 22 def usage() :23 """ returns nagios status UNKNOWN with24 a one line usage description25 usage() calls nagios_return()26 """27 nagios_return('UNKNOWN',28 "usage: %s -h host" % (sys.argv[0]))29 24 30 25 def nagios_return(code, response) : … … 90 85 91 86 92 def check_condition(host) : 93 94 UP_URL = '/aai/clarin-sp-metadata.xml' 87 def check_condition(host, URL, CLARIN_server_root_directory_path) : 95 88 96 89 conn = httplib.HTTPSConnection(host) 97 90 98 91 # Use exception handling. 99 conn.request("GET", U P_URL)92 conn.request("GET", URL) 100 93 101 94 r1 = conn.getresponse() … … 117 110 return { 118 111 "code" : "OK", 119 "message" : 'Host %s, service %s is up and returns well-formed and valid XML data .' % (host, DESCRIPTION)112 "message" : 'Host %s, service %s is up and returns well-formed and valid XML data at %s.' % (host, DESCRIPTION, URL) 120 113 } 121 114 else : 122 115 return { 123 116 "code" : "CRITICAL", 124 "message" : 'Host %s, service %s is up and returns well-formed, but invalid XML data .' % (host, DESCRIPTION)117 "message" : 'Host %s, service %s is up and returns well-formed, but invalid XML data at %s.' % (host, DESCRIPTION, URL) 125 118 } 126 119 else : 127 120 return { 128 121 "code" : "CRITICAL", 129 "message" : 'Host %s, service %s is up but returns non-well-formed XML data .' % (host, DESCRIPTION)122 "message" : 'Host %s, service %s is up but returns non-well-formed XML data %s.' % (host, DESCRIPTION, URL) 130 123 } 131 124 else : 132 125 return { 133 126 "code" : "CRITICAL", 134 "message" : 'Host %s, service %s has a problem.' % (host, DESCRIPTION)127 "message" : 'Host %s, service %s, location %s has a problem.' % (host, DESCRIPTION, URL) 135 128 } 136 129 137 def test_case(host ) :130 def test_case(host, URL, CLARIN_server_root_directory_path) : 138 131 metadata_file = open(os.path.join(CLARIN_server_root_directory_path, "aai/clarin-sp-metadata.xml"), 139 132 mode = "r+", … … 153 146 return { 154 147 "code" : "OK", 155 "message" : 'Host %s, service %s is up and returns well-formed and valid XML data .' % (host, DESCRIPTION)148 "message" : 'Host %s, service %s is up and returns well-formed and valid XML data at %s.' % (host, DESCRIPTION, URL) 156 149 } 157 150 else : 158 151 return { 159 152 "code" : "CRITICAL", 160 "message" : 'Host %s, service %s is up and returns well-formed, but invalid XML data .' % (host, DESCRIPTION)153 "message" : 'Host %s, service %s is up and returns well-formed, but invalid XML data at %s.' % (host, DESCRIPTION, URL) 161 154 } 162 155 else : 163 156 return { 164 157 "code" : "CRITICAL", 165 "message" : 'Host %s, service %s is up, but returns non-well-formed XML data .' % (host, DESCRIPTION)158 "message" : 'Host %s, service %s is up, but returns non-well-formed XML data at %s.' % (host, DESCRIPTION, URL) 166 159 } 167 160 168 161 Sys.exit(0) 169 162 170 def main() :171 """ example options processing172 here we're expecting 1 option "-h"173 with a parameter174 """175 163 176 if len(sys.argv) < 2 : 177 usage() 164 def special_main_subroutine(host, 165 URL, 166 CLARIN_server_root_directory_path) : 178 167 179 try: 180 opts, args = getopt.getopt(sys.argv[1:], "h:") 181 except getopt.GetoptError, err : 182 usage() 183 184 for o, value in opts : 185 if o == "-h" : 186 host = value 187 elif o == "-d" : 188 CLARIN_server_root_directory_path = value 189 else : 190 usage() 168 result = check_condition(host = host, 169 URL = URL, 170 CLARIN_server_root_directory_path = CLARIN_server_root_directory_path) 191 171 192 #result = test_case(host);193 result = check_condition(host)194 172 nagios_return(result['code'], result['message']) 195 173 196 174 if __name__ == "__main__" : 197 main()198 175 generic_tla_monitoring.main(special_main_subroutine, 176 command_line_parameters) -
monitoring/plugins/mpi/integration_test.R
r3302 r3304 8 8 quote = "", 9 9 row.names = NULL, 10 check.names = FALSE 10 check.names = FALSE, 11 11 as.is = TRUE); 12 12 -
monitoring/plugins/mpi/plugins_hosts_services.tab
r3291 r3304 10 10 check_lat_annex.py Annex corpus1.mpi.nl http '/ds/annex/runLoader?nodeid=MPI600401%23' 11 11 check_lat_oai_endpoint.py OAI-PMH corpus1.mpi.nl http '/ds/oaiprovider/oai2?verb=Identify' 12 check_clarin_saml.py SAML www.clarin.eu https 12 check_clarin_saml.py SAML www.clarin.eu https '/aai/clarin-sp-metadata.xml' 13 13 check_clarin_discojuice_html.py Discojuice HTML catalog.clarin.eu http '/mw1/sds/discojuice' 14 14 check_clarin_discojuice_html.py Discojuice HTML catalog.clarin.eu http '/mw2/sds/discojuice'
Note: See TracChangeset
for help on using the changeset viewer.