Adds support for OSMMON_DATABASE_COMMONKEY to decrypt vim passwords
[osm/MON.git] / osm_mon / plugins / OpenStack / Aodh / notifier.py
index a1c85e6..71c6c1c 100644 (file)
@@ -25,6 +25,7 @@
 import json
 import logging
 import os
+import re
 import sys
 import time
 
@@ -130,7 +131,6 @@ def run(server_class=HTTPServer, handler_class=NotifierHandler, port=8662):
     try:
         server_address = ('', port)
         httpd = server_class(server_address, handler_class)
-        print('Starting alarm notifier...')
         log.info("Starting alarm notifier server on port: %s", port)
         httpd.serve_forever()
     except Exception as exc:
@@ -138,10 +138,11 @@ def run(server_class=HTTPServer, handler_class=NotifierHandler, port=8662):
 
 
 if __name__ == "__main__":
-    from sys import argv
-
-    # Runs the webserver
-    if len(argv) == 2:
-        run(port=int(argv[1]))
+    cfg = Config.instance()
+    p = re.compile(':(\d+)', re.IGNORECASE)
+    m = p.search(cfg.OS_NOTIFIER_URI)
+    if m:
+        port = m.group(1)
+        run(port=int(port))
     else:
         run()