Skip to content

Commit

Permalink
Remove debug prints infavor of logging
Browse files Browse the repository at this point in the history
  • Loading branch information
brd committed Oct 15, 2021
1 parent ba81de3 commit 63113a5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
4 changes: 0 additions & 4 deletions passiveagent/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions passiveagent/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion passiveagent/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,))

Expand Down

0 comments on commit 63113a5

Please sign in to comment.