port 8081 for cadvisor bcause 8080 is already taken by ryu rest api
[osm/vim-emu.git] / src / emuvim / dcemulator / monitoring.py
index 2e1e041..875913f 100755 (executable)
@@ -45,7 +45,8 @@ class to read openflow stats from the Ryu controller of the DCNetwork
 """\r
 \r
 PUSHGATEWAY_PORT = 9091\r
-CADVISOR_PORT = 8080\r
+# we cannot use port 8080 because ryu-ofrest api  is already using that one\r
+CADVISOR_PORT = 8081\r
 \r
 class DCNetworkMonitor():\r
     def __init__(self, net):\r
@@ -96,8 +97,8 @@ class DCNetworkMonitor():
 \r
         # helper tools\r
         # cAdvisor, Prometheus pushgateway are started as external container, to gather monitoring metric in son-emu\r
-        self.start_PushGateway()\r
-        self.start_cAdvisor()\r
+        self.pushgateway_process = self.start_PushGateway()\r
+        self.cadvisor_process = self.start_cAdvisor()\r
 \r
 \r
     # first set some parameters, before measurement can start\r
@@ -467,7 +468,7 @@ class DCNetworkMonitor():
             logging.warning("Pushgateway not reachable: {0} {1}".format(Exception, e))\r
 \r
 \r
-    def start_Prometheus(self, port=CADVISOR_PORT):\r
+    def start_Prometheus(self, port=9090):\r
         # prometheus.yml configuration file is located in the same directory as this file\r
         cmd = ["docker",\r
                "run",\r
@@ -493,7 +494,7 @@ class DCNetworkMonitor():
         logging.info('Start Prometheus Push Gateway container {0}'.format(cmd))\r
         return Popen(cmd)\r
 \r
-    def start_cAdvisor(self, port=8080):\r
+    def start_cAdvisor(self, port=CADVISOR_PORT):\r
         cmd = ["docker",\r
                "run",\r
                "--rm",\r
@@ -521,7 +522,7 @@ class DCNetworkMonitor():
             self.prometheus_process.terminate()\r
             self.prometheus_process.kill()\r
             self._stop_container('prometheus')\r
-\r
+        '''\r
         if self.pushgateway_process is not None:\r
             logging.info('stopping pushgateway container')\r
             self.pushgateway_process.terminate()\r
@@ -533,7 +534,6 @@ class DCNetworkMonitor():
             self.cadvisor_process.terminate()\r
             self.cadvisor_process.kill()\r
             self._stop_container('cadvisor')\r
-        '''\r
 \r
     def switch_tx_rx(self,metric=''):\r
         # when monitoring vnfs, the tx of the datacenter switch is actually the rx of the vnf\r