diff --git a/pymod/alarmtoqueue.py b/pymod/alarmtoqueue.py index 5eadc9b..27b6b3c 100644 --- a/pymod/alarmtoqueue.py +++ b/pymod/alarmtoqueue.py @@ -14,8 +14,8 @@ import pytz import sys -conf = '/etc/argo-nagios-ams-publisher/ams-publisher.conf' -logfile = '/var/log/argo-nagios-ams-publisher/ams-publisher.log' + +CONF = '/etc/argo-nagios-ams-publisher/ams-publisher.conf' def seteuser(user): @@ -46,7 +46,7 @@ def build_msg(args, *headers): def main(): parser = argparse.ArgumentParser() - lobj = log.Logger(sys.argv[0], logfile) + lobj = log.Logger(sys.argv[0]) logger = lobj.get() confopts = config.parse_config(logger) nagioshost = confopts['general']['host'] diff --git a/pymod/metrictoqueue.py b/pymod/metrictoqueue.py index 6b66a85..950eb2e 100644 --- a/pymod/metrictoqueue.py +++ b/pymod/metrictoqueue.py @@ -14,8 +14,7 @@ import datetime import pytz -conf = '/etc/argo-nagios-ams-publisher/ams-publisher.conf' -logfile = '/var/log/argo-nagios-ams-publisher/ams-publisher.log' +CONF = '/etc/argo-nagios-ams-publisher/ams-publisher.conf' def seteuser(user): @@ -47,7 +46,7 @@ def build_msg(args, *headers): def main(): parser = argparse.ArgumentParser() - lobj = log.Logger(sys.argv[0], logfile) + lobj = log.Logger(sys.argv[0]) logger = lobj.get() confopts = config.parse_config(logger) nagioshost = confopts['general']['host'] diff --git a/pymod/run.py b/pymod/run.py index 0f9be2e..d1daa88 100644 --- a/pymod/run.py +++ b/pymod/run.py @@ -82,6 +82,10 @@ def init_dirq_consume(workers, daemonized, sockstat): consumers[-1].daemon = False consumers[-1].start() + shared = Shared() + workers_name = ', '.join(consumer.name for consumer in consumers) + shared.log.info('Started {} workers'.format(workers_name)) + if worker: localevents.update({'lck-stats': Lock()}) localevents.update({'usr1-stats': Event()}) @@ -93,9 +97,6 @@ def init_dirq_consume(workers, daemonized, sockstat): statsp.start() prevstattime = int(time.time()) - shared = Shared() - workers_name = ', '.join(consumer.name for consumer in consumers) - shared.log.info('Started {} workers'.format(workers_name)) while True: if int(time.time()) - prevstattime >= shared.general['statseveryhour'] * 3600: shared.log.info('Periodic report (every %sh)' % shared.general['statseveryhour'])