def run_check(name, path=None):
 confd_path = (path or os.path.join(get_confd_path(get_os()), ('%s.yaml' % name)))
 try:
  f = open(confd_path)
 except IOError:
  raise Exception(('Unable to open configuration at %s' % confd_path))
 config_str = f.read()
 f.close()
 (check, instances) = get_check(name, config_str)
 if (not instances):
  raise Exception('YAML configuration returned no instances.')
 for instance in instances:
  check.check(instance)
  if check.has_events():
   print 'Events:\n'
   pprint(check.get_events(), indent=4)
  print 'Metrics:\n'
  pprint(check.get_metrics(), indent=4)

def run_check ( name , path = None ) : confd_path = ( path or os . path . join ( get_confd_path ( get_os ( ) ) , ( '%s.yaml' % name ) ) ) try : f = open ( confd_path ) except IOError : raise Exception ( ( 'Unable to open configuration at %s' % confd_path ) ) config_str = f . read ( ) f . close ( ) ( check , instances ) = get_check ( name , config_str ) if ( not instances ) : raise Exception ( 'YAML configuration returned no instances.' ) for instance in instances : check . check ( instance ) if check . has_events ( ) : print 'Events:\n' pprint ( check . get_events ( ) , indent = 4 ) print 'Metrics:\n' pprint ( check . get_metrics ( ) , indent = 4 )
test custom checks on windows .