projects
/
osm
/
MON.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adds support for custom project and user domain names defined in vim config
[osm/MON.git]
/
osm_mon
/
cmd
/
mon_evaluator.py
diff --git
a/osm_mon/cmd/mon_evaluator.py
b/osm_mon/cmd/mon_evaluator.py
index
79adabd
..
3835d7e
100644
(file)
--- a/
osm_mon/cmd/mon_evaluator.py
+++ b/
osm_mon/cmd/mon_evaluator.py
@@
-21,36
+21,37
@@
# For those usages not covered by the Apache License, Version 2.0 please
# contact: bdiaz@whitestack.com or glavado@whitestack.com
##
# For those usages not covered by the Apache License, Version 2.0 please
# contact: bdiaz@whitestack.com or glavado@whitestack.com
##
+import argparse
import logging
import sys
import logging
import sys
+from osm_mon.core.config import Config
from osm_mon.core.database import DatabaseManager
from osm_mon.core.database import DatabaseManager
-from osm_mon.core.settings import Config
from osm_mon.evaluator.evaluator import Evaluator
def main():
from osm_mon.evaluator.evaluator import Evaluator
def main():
- cfg = Config.instance()
+ parser = argparse.ArgumentParser(prog='osm-policy-agent')
+ parser.add_argument('--config-file', nargs='?', help='POL configuration file')
+ args = parser.parse_args()
+ cfg = Config(args.config_file)
root = logging.getLogger()
root = logging.getLogger()
- root.setLevel(logging.getLevelName(cfg.
OSMMON_LOG_LEVEL
))
+ root.setLevel(logging.getLevelName(cfg.
get('global', 'loglevel')
))
ch = logging.StreamHandler(sys.stdout)
ch = logging.StreamHandler(sys.stdout)
- ch.setLevel(logging.getLevelName(cfg.
OSMMON_LOG_LEVEL
))
+ 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)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s', '%m/%d/%Y %I:%M:%S %p')
ch.setFormatter(formatter)
root.addHandler(ch)
- kafka_logger = logging.getLogger('kafka')
- kafka_logger.setLevel(logging.getLevelName(cfg.OSMMON_KAFKA_LOG_LEVEL))
-
log = logging.getLogger(__name__)
log.info("Starting MON Evaluator...")
log = logging.getLogger(__name__)
log.info("Starting MON Evaluator...")
- log.debug("Config: %s",
vars(cfg)
)
+ log.debug("Config: %s",
cfg.conf
)
log.info("Initializing database...")
log.info("Initializing database...")
- db_manager = DatabaseManager()
+ db_manager = DatabaseManager(
cfg
)
db_manager.create_tables()
log.info("Database initialized correctly.")
db_manager.create_tables()
log.info("Database initialized correctly.")
- evaluator = Evaluator()
+ evaluator = Evaluator(
cfg
)
evaluator.evaluate_forever()
evaluator.evaluate_forever()