"""\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
\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
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
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
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
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