def _get_check_class(check_name, check_path):
 from checks import AgentCheck
 check_class = None
 try:
  check_module = imp.load_source(('checksd_%s' % check_name), check_path)
 except Exception as e:
  traceback_message = traceback.format_exc()
  log.exception(('Unable to import check module %s.py from checks.d' % check_name))
  return {'error': e, 'traceback': traceback_message}
 check_class = None
 classes = inspect.getmembers(check_module, inspect.isclass)
 for (_, clsmember) in classes:
  if (clsmember == AgentCheck):
   continue
  if issubclass(clsmember, AgentCheck):
   check_class = clsmember
   if (AgentCheck in clsmember.__bases__):
    continue
   else:
    break
 return check_class

def _get_check_class ( check_name , check_path ) : from checks import AgentCheck check_class = None try : check_module = imp . load_source ( ( 'checksd_%s' % check_name ) , check_path ) except Exception as e : traceback_message = traceback . format_exc ( ) log . exception ( ( 'Unable to import check module %s.py from checks.d' % check_name ) ) return { 'error' : e , 'traceback' : traceback_message } check_class = None classes = inspect . getmembers ( check_module , inspect . isclass ) for ( _ , clsmember ) in classes : if ( clsmember == AgentCheck ) : continue if issubclass ( clsmember , AgentCheck ) : check_class = clsmember if ( AgentCheck in clsmember . __bases__ ) : continue else : break return check_class
return the corresponding check class for a check name if available .