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_server.py
diff --git
a/osm_mon/cmd/mon_server.py
b/osm_mon/cmd/mon_server.py
index
a100c20
..
6698339
100644
(file)
--- a/
osm_mon/cmd/mon_server.py
+++ b/
osm_mon/cmd/mon_server.py
@@
-21,31
+21,39
@@
# 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 asyncio
import logging
import sys
import logging
import sys
-from osm_mon.core.settings import Config
+from osm_mon.core.config import Config
+from osm_mon.core.database import DatabaseManager
from osm_mon.server.server import Server
def main():
from osm_mon.server.server import Server
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 Server...")
log = logging.getLogger(__name__)
log.info("Starting MON Server...")
- log.debug("Config: %s", vars(cfg))
- server = Server()
+ log.debug("Config: %s", cfg.conf)
+ log.info("Initializing database...")
+ db_manager = DatabaseManager(cfg)
+ db_manager.create_tables()
+ log.info("Database initialized correctly.")
+ loop = asyncio.get_event_loop()
+ server = Server(cfg, loop)
server.run()
server.run()