Merge pull request #90 from stevenvanrossem/master
authorstevenvanrossem <steven.vanrossem@intec.ugent.be>
Fri, 29 Apr 2016 10:44:22 +0000 (12:44 +0200)
committerstevenvanrossem <steven.vanrossem@intec.ugent.be>
Fri, 29 Apr 2016 10:44:22 +0000 (12:44 +0200)
minor changes

src/emuvim/dcemulator/monitoring.py
src/emuvim/dcemulator/net.py
src/emuvim/dcemulator/prometheus.yml

index 54e7986..b3ec7ee 100755 (executable)
@@ -246,12 +246,14 @@ class DCNetworkMonitor():
                     #logging.info('first measurement')\r
                     time.sleep(1)\r
                     self.monitor_lock.release()\r
+\r
                     metric_rate = self.get_network_metrics()\r
                     return metric_rate\r
+\r
                 else:\r
                     time_delta = (port_uptime - metric_dict['previous_monitor_time'])\r
                     metric_rate = (this_measurement - metric_dict['previous_measurement']) / float(time_delta)\r
-                    # logging.info('uptime:{2} delta:{0} rate:{1}'.format(time_delta,byte_rate,port_uptime))\r
+                    logging.info('metric: {0} rate:{1}'.format(metric_dict['metric_key'], metric_rate))\r
 \r
                 metric_dict['previous_measurement'] = this_measurement\r
                 metric_dict['previous_monitor_time'] = port_uptime\r
@@ -274,6 +276,7 @@ class DCNetworkMonitor():
                "--rm",\r
                "-p", "{0}:9090".format(port),\r
                "-v", "{0}/prometheus.yml:/etc/prometheus/prometheus.yml".format(os.path.dirname(os.path.abspath(__file__))),\r
+               "-v", "{0}/profile.rules:/etc/prometheus/profile.rules".format(os.path.dirname(os.path.abspath(__file__))),\r
                "--name", "prometheus",\r
                "prom/prometheus"\r
                ]\r
index 110256e..dbfde5c 100755 (executable)
@@ -282,7 +282,9 @@ class DCNetwork(Dockernet):
 
             #logging.info("add flow in switch: {0} in_port: {1} out_port: {2}".format(current_node.name, switch_inport, switch_outport))
             # set of entry via ovs-ofctl
-            # TODO use rest API of ryu to set flow entries to correct witch dpid
+            # TODO use rest API of ryu to set flow entries to correct dpid
+            # TODO this only sets port in to out, no match, so this will give trouble when multiple services are deployed...
+            # TODO need multiple matches to do this (VLAN tags)
             if isinstance( current_node, OVSSwitch ):
                 match = 'in_port=%s' % switch_inport
 
index 4db5b6f..2412f85 100644 (file)
@@ -1,11 +1,16 @@
 global:
   scrape_interval:     15s # By default, scrape targets every 15 seconds.
+  evaluation_interval: 5s
 
   # Attach these labels to any time series or alerts when communicating with
   # external systems (federation, remote storage, Alertmanager).
   external_labels:
     monitor: 'codelab-monitor'
 
+# Rule files specifies a list of files from which rules are read.
+rule_files:
+  - 'profile.rules'
+
 # A scrape configuration containing exactly one endpoint to scrape:
 # Here it's Prometheus itself.
 scrape_configs: