Changeset 1998


Ignore:
Timestamp:
07/02/12 12:58:03 (12 years ago)
Author:
dietuyt
Message:

Fixed string formatting to be compatible with python < 2.6

Location:
monitoring/plugins/mpi
Files:
3 edited

Legend:

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

    r1996 r1998  
    4545        return {
    4646                "code"      : "OK",
    47                 "message"   : 'Host "{0}", service "{1}" is up.'.format(host, DESCRIPTION)
     47                "message"   : 'Host %s, service %s is up.' % (host, DESCRIPTION)
    4848                }
    4949    else:
    5050        return {
    5151                "code"      : "CRITICAL",
    52                 "message"   : 'Host "{0}", service "{1}" has a problem.'.format(host, DESCRIPTION)
     52                "message"   : 'Host %s, service %s has a problem.' % (host, DESCRIPTION)
    5353                }
    5454
  • monitoring/plugins/mpi/check_clarin_vlo.py

    r1996 r1998  
    66
    77nagios_codes = {
    8                 'OK'        : 0,
    9                 'WARNING'   : 1,
    10                 'CRITICAL'  : 2,
    11                 'UNKNOWN'   : 3,
    12                 'DEPENDENT' : 4
    13                 }
     8'OK'        : 0,
     9'WARNING'   : 1,
     10'CRITICAL'  : 2,
     11'UNKNOWN'   : 3,
     12'DEPENDENT' : 4
     13}
    1414
    1515def usage():
     
    1818        usage() calls nagios_return()
    1919    """
    20     nagios_return('UNKNOWN',
    21                   "usage: {0} -h host".format(sys.argv[0]))
     20    nagios_return('UNKNOWN',"usage: {0} -h host".format(sys.argv[0]))
    2221
    2322def nagios_return(code, response):
     
    4241   
    4342    if r1.status == 200:
    44         return {
    45                 "code"      : "OK",
    46                 "message"   : 'Host "{0}", service "{1}" is up.'.format(host, DESCRIPTION)
    47                 }
     43        return { "code"      : "OK", "message"   : 'Host %s, service %s is up.' % (host, DESCRIPTION) }
    4844    else:
    49         return {
    50                 "code"      : "CRITICAL",
    51                 "message"   : 'Host "{0}", service "{1}" has a problem!'.format(host, DESCRIPTION)
    52                 }
    53 
     45        return { "code"      : "CRITICAL", "message"   : 'Host %s, service %s has a problem!' % (host, DESCRIPTION) }
    5446
    5547def main():
  • monitoring/plugins/mpi/check_lat_cql_endpoint.py

    r1994 r1998  
    3636def check_response_data_validity(data) :
    3737    data_tree_root_element  = xml.etree.ElementTree.XML(text = data)
    38 
    39     valid_root_element_tag  = "{{{0}}}explainResponse".format(CQL_NAMESPACE)
    40 
     38       
     39    valid_root_element_tag  = "{%s}explainResponse" % (CQL_NAMESPACE)
     40       
    4141    if data_tree_root_element.tag == valid_root_element_tag :
    4242        return True
     
    6464            return {
    6565                    "code"      : "OK",
    66                     "message"   : 'Host "{0}", service "{1}" is up and returns valid data.'.format(host, DESCRIPTION)
     66                    "message"   : 'Host %s, service %s is up and returns valid data.' % (host, DESCRIPTION)
    6767                   }
    6868        else :
    6969            return {
    7070                    "code"      : "CRITICAL",
    71                     "message"   : 'Host "{0}", service "{1}" is up but returns invalid data!'.format(host, DESCRIPTION)
     71                    "message"   : 'Host %s, service %s is up but returns invalid data!' % (host, DESCRIPTION)
    7272                   }
    7373
     
    7575        return {
    7676                "code"      : "CRITICAL",
    77                 "message"   : 'Host "{0}", service "{1}" has a problem.'.format(host, DESCRIPTION)
     77                "message"   : 'Host %s, service %s has a problem.' % (host, DESCRIPTION)
    7878               }
    7979
Note: See TracChangeset for help on using the changeset viewer.