projects
/
osm
/
MON.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bug 1842: LTS Support
[osm/MON.git]
/
osm_mon
/
cmd
/
mon_collector.py
diff --git
a/osm_mon/cmd/mon_collector.py
b/osm_mon/cmd/mon_collector.py
index
902d2e7
..
30e6676
100644
(file)
--- a/
osm_mon/cmd/mon_collector.py
+++ b/
osm_mon/cmd/mon_collector.py
@@
-27,20
+27,22
@@
import sys
from osm_mon.collector.collector import Collector
from osm_mon.core.config import Config
from osm_mon.collector.collector import Collector
from osm_mon.core.config import Config
-from osm_mon.cmd.
common_function
s import wait_till_core_services_are_ready
+from osm_mon.cmd.
mon_util
s import wait_till_core_services_are_ready
def main():
def main():
- parser = argparse.ArgumentParser(prog=
'osm-mon-collector'
)
- parser.add_argument(
'--config-file', nargs='?', help='MON configuration file'
)
+ parser = argparse.ArgumentParser(prog=
"osm-mon-collector"
)
+ parser.add_argument(
"--config-file", nargs="?", help="MON configuration file"
)
args = parser.parse_args()
cfg = Config(args.config_file)
root = logging.getLogger()
args = parser.parse_args()
cfg = Config(args.config_file)
root = logging.getLogger()
- root.setLevel(logging.getLevelName(cfg.get(
'global', 'loglevel'
)))
+ root.setLevel(logging.getLevelName(cfg.get(
"global", "loglevel"
)))
ch = logging.StreamHandler(sys.stdout)
ch = logging.StreamHandler(sys.stdout)
- ch.setLevel(logging.getLevelName(cfg.get('global', 'loglevel')))
- formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s', '%m/%d/%Y %I:%M:%S %p')
+ ch.setLevel(logging.getLevelName(cfg.get("global", "loglevel")))
+ formatter = logging.Formatter(
+ "%(asctime)s - %(name)s - %(levelname)s - %(message)s", "%m/%d/%Y %I:%M:%S %p"
+ )
ch.setFormatter(formatter)
root.addHandler(ch)
ch.setFormatter(formatter)
root.addHandler(ch)
@@
-49,11
+51,15
@@
def main():
log.info("Starting MON Collector...")
log.debug("Config: %s", cfg.conf)
log.info("Initializing database...")
log.info("Starting MON Collector...")
log.debug("Config: %s", cfg.conf)
log.info("Initializing database...")
- collector = Collector(cfg)
- collector.collect_forever()
+ try:
+ collector = Collector(cfg)
+ collector.collect_forever()
+ except Exception as e:
+ log.error("Failed to start MON Collector")
+ log.exception("Exception: %s", str(e))
else:
log.error("Failed to start MON Collector")
else:
log.error("Failed to start MON Collector")
-if __name__ ==
'__main__'
:
+if __name__ ==
"__main__"
:
main()
main()