def __init__(self, *args, **kwargs): self.collector = args[0].split('_', 3)[-1:][0] super(ecel_Service, self).__init__(*args, **kwargs) self.logger.addHandler( SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.INFO)
def __init__(self, **kwargs): self.r = kwargs.pop('redis', None) self.test_class = kwargs.pop('test_class', SingleTestRun) self.epm_class = kwargs.pop('epm_class', EPM) self.results_class = kwargs.pop('results_class', RedisResults) self.loop_count = kwargs.pop('loop_count', None) self.substitute_logger = kwargs.pop('logger', None) self.yaml_path = kwargs.pop('yaml_path', '/etc/epm.yaml') self.namespace = kwargs.pop('namespace', None) self.test_secs = kwargs.pop('test_secs', None) self.scans_per_sec = kwargs.pop('scans_per_sec', 1000) self.sleep_secs = kwargs.pop('sleep_secs', 1.0 / self.scans_per_sec) super(SensorsDaemon, self).__init__('epmsensorsd', **kwargs) self.logger.addHandler( SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.INFO) if self.substitute_logger: self.logger = self.substitute_logger self.epm = None self.rr = None
def __init__(self, *args, **kwargs): super(Service, self).__init__(*args, **kwargs) self.syslog_handler = SysLogHandler(address=service.find_syslog(), facility=SysLogHandler.LOG_DAEMON) formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s') self.syslog_handler.setFormatter(formatter) logging.getLogger().addHandler(self.syslog_handler)
def __init__(self, *args, **kwargs): super(MyService, self).__init__(*args, **kwargs) self.logger.addHandler(SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.INFO) self.fortigateList = [] self.conf = yaml
def __init__(self, *args, **kwargs): self.command = kwargs['command'] kwargs.pop('command', None) super(MarketFetcherService, self).__init__(*args, **kwargs) self.logger.addHandler( SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.INFO)
def __init__(self, *args, **kwargs): super(DownloadService, self).__init__(*args, **kwargs) self.logger.addHandler(SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.INFO) self.readers = [] self.method = 'disk' self.directory = 'data' self.time_interval = 30
def __init__(self, filepath='/Users/administrator/projects/Independent/jarvis/', *args, **kwargs): super(Jarvis, self).__init__(*args, **kwargs) self.logger.addHandler( SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.INFO) self.filepath = filepath # self.talk('Ready, sir.') self.checkin()
def __init__(self, **kwargs): r = kwargs.pop('redis', None) if r: self.rr = RedisResults(redis=r) else: self.rr = RedisResults() super(SheetsDaemon, self).__init__('sheetsd', **kwargs) self.logger.addHandler( SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.INFO)
def __init__(self, *args, **kwargs): self.working_dir = "" if 'working_directory' in kwargs: self.working_dir = str(kwargs['working_directory']) del kwargs['working_directory'] super(HTService, self).__init__(*args, **kwargs) # Use syslog for catching fatal problems which are not logged otherwise self.logger.addHandler( SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.WARN) self.database = None self.config = None
def __init__(self, *args, **kwargs): super(MyService, self).__init__(*args, **kwargs) self.logger.addHandler( SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.INFO) self.waitTime = 600 self.argList = ["hdfs", "dfs", "-ls", "-t", "-r"] self.odsposoutlet = self.argList + [ '/npd/ODS/ODS_INPUTS_BZ2/ODS_POSOUTLETITEMS/' ] self.odsitems = self.argList + ['/npd/ODS/ODS_INPUTS_BZ2/ODS_POSITEMS'] self.application_command = [ "spark-submit", "--driver-java-options", '"-Dlog4j.configuration=file:src/main/python/dictionary/configuration/log4j.properties"', "--master", "yarn", "--conf", "spark.driver.memory=10g", "--num-executors", "5", "--executor-memory", "8g", "--executor-cores", "4", "--py-files", "dq_machine.zip", "--packages", "mysql:mysql-connector-java:5.1.39", "src/main/python/main.py", "0" ]
def __init__(self, *args, **kwargs): super(Gmail, self).__init__(*args, **kwargs) self.logger.addHandler(SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) self.logger.setLevel(logging.INFO)
def __init__(self, *args, **kwargs): """ Load Yaml configuration and Init logger """ super(PFUI_Firewall, self).__init__(*args, **kwargs) self.threads = [] self.soc = None self.db = None # Load YAML Configuration try: self.cfg = safe_load(open(CONFIG_LOCATION)) if "LOGGING" not in self.cfg: self.cfg['LOGGING'] = True if "LOG_LEVEL" not in self.cfg: self.cfg['LOG_LEVEL'] = "DEBUG" if "SOCKET_LISTEN" not in self.cfg: self.cfg['SOCKET_LISTEN'] = "0.0.0.0" if "SOCKET_PORT" not in self.cfg: self.cfg['SOCKET_PORT'] = 10001 if "SOCKET_TIMEOUT" not in self.cfg: self.cfg['SOCKET_TIMEOUT'] = 2 if "SOCKET_BUFFER" not in self.cfg: self.cfg['SOCKET_BUFFER'] = 1024 if "SOCKET_BACKLOG" not in self.cfg: self.cfg['SOCKET_BACKLOG'] = 5 if "REDIS_HOST" not in self.cfg: self.cfg['REDIS_HOST'] = "127.0.0.1" if "REDIS_PORT" not in self.cfg: self.cfg['REDIS_PORT'] = 6379 if "REDIS_DB" not in self.cfg: self.cfg['REDIS_DB'] = 1024 if "SCAN_PERIOD" not in self.cfg: self.cfg['SCAN_PERIOD'] = 60 if "TTL_MULTIPLIER" not in self.cfg: self.cfg['TTL_MULTIPLIER'] = 1 if "CTL" not in self.cfg: self.cfg['CTL'] = "IOCTL" if "DEVPF" not in self.cfg: self.cfg['DEVPF'] = "/dev/pf" if "AF4_TABLE" not in self.cfg: print("AF4_TABLE not found in YAML Config File. Exiting.") sys.exit(2) if "AF4_FILE" not in self.cfg: print("AF4_FILE not found in YAML Config File. Exiting.") sys.exit(2) if "AF6_TABLE" not in self.cfg: print("AF6_TABLE not found in YAML Config File. Exiting.") sys.exit(2) if "AF6_FILE" not in self.cfg: print("AF6_FILE not found in YAML Config File. Exiting.") sys.exit(2) except Exception as e: print("YAML Config File not found or cannot load. {}".format(e)) sys.exit(2) # Init Logging self.logger.addHandler( SysLogHandler(address=find_syslog(), facility=SysLogHandler.LOG_DAEMON)) if self.cfg['LOG_LEVEL'] == 'DEBUG' or self.cfg['LOG_LEVEL'] == 'INFO': self.logger.setLevel(logging.DEBUG) else: self.logger.setLevel(logging.ERROR)