diff --git a/passiveagent/check.py b/passiveagent/check.py index 211bc0a..19e3708 100644 --- a/passiveagent/check.py +++ b/passiveagent/check.py @@ -12,16 +12,12 @@ def check_check(config): dir = config['plugin directives']['plugin_path'] if os.path.isdir(dir): for f in config['passive checks']: - print(f'f: {f}') - print(f'line: {config["passive checks"][f]}') file = os.path.join(dir,config['passive checks'][f].split()[0]) if not os.path.isfile(file): logging.warning('%s: is not accessible', file) - print(f'check: {file} is not accessible') config.remove_option('passive checks', f) else: # isdir logging.error('plugin_path: %s: is not accessible', dir) - print(f'plugin_path: {dir} is not accessible') sys.exit(2) return config diff --git a/passiveagent/config.py b/passiveagent/config.py index 015b715..dee68e7 100644 --- a/passiveagent/config.py +++ b/passiveagent/config.py @@ -44,7 +44,6 @@ def read_config(c): success = True except Exception as e: logging.error('Error opening and reading: %s', str(e)) - print(f'Error opening and reading: {f}: {str(e)}') sys.exit(2) if success: if 'nrdp' in config: @@ -95,12 +94,11 @@ def read_config(c): c['passive checks'][k]['command'] = config['plugin directives']['plugin_path'] + '/' + config['passive checks'][k] # strip slash components away # %HOSTNAME%|dns|60 = check_dns/-H/_healthcheck.corp.care2.com/-q/TXT/-t/5:3 - print(f'passive command: {c["passive checks"][k]["command"]}') + logging.debug(f'passive command: {c["passive checks"][k]["command"]}') c['passive checks'][k]['command'] = check_command(c['passive checks'][k]['command']) if c['passive checks'][k]['command'] == None: logging.warning('unable to find command for: %s', c['passive checks'][k]['checkname']) c['passive checks'].pop(k) else: - print(f'No .cfg files found in {c["config_dir"]}') logging.error('No .cfg files found in: %s', c['config_dir']) sys.exit(2) diff --git a/passiveagent/schedule.py b/passiveagent/schedule.py index 7fbe2b5..ba460ca 100644 --- a/passiveagent/schedule.py +++ b/passiveagent/schedule.py @@ -11,7 +11,7 @@ def start_sched(c): c['s'] = sched.scheduler() for pc in c['passive checks']: r = random.randrange(1,7) - print(f'scheduling: {pc} in {c["passive checks"][pc]["interval"] - r}') + logging.warning(f'scheduling: {pc} in {c["passive checks"][pc]["interval"] - r}') c['s'].enter(c['passive checks'][pc]['interval'] - r, 1, check.run_check, argument=(c, pc,))