Merge pull request #90 from stevenvanrossem/master
minor changes
diff --git a/src/emuvim/dcemulator/monitoring.py b/src/emuvim/dcemulator/monitoring.py
index 54e7986..b3ec7ee 100755
--- a/src/emuvim/dcemulator/monitoring.py
+++ b/src/emuvim/dcemulator/monitoring.py
@@ -246,12 +246,14 @@
#logging.info('first measurement')
time.sleep(1)
self.monitor_lock.release()
+
metric_rate = self.get_network_metrics()
return metric_rate
+
else:
time_delta = (port_uptime - metric_dict['previous_monitor_time'])
metric_rate = (this_measurement - metric_dict['previous_measurement']) / float(time_delta)
- # logging.info('uptime:{2} delta:{0} rate:{1}'.format(time_delta,byte_rate,port_uptime))
+ logging.info('metric: {0} rate:{1}'.format(metric_dict['metric_key'], metric_rate))
metric_dict['previous_measurement'] = this_measurement
metric_dict['previous_monitor_time'] = port_uptime
@@ -274,6 +276,7 @@
"--rm",
"-p", "{0}:9090".format(port),
"-v", "{0}/prometheus.yml:/etc/prometheus/prometheus.yml".format(os.path.dirname(os.path.abspath(__file__))),
+ "-v", "{0}/profile.rules:/etc/prometheus/profile.rules".format(os.path.dirname(os.path.abspath(__file__))),
"--name", "prometheus",
"prom/prometheus"
]
diff --git a/src/emuvim/dcemulator/net.py b/src/emuvim/dcemulator/net.py
index 110256e..dbfde5c 100755
--- a/src/emuvim/dcemulator/net.py
+++ b/src/emuvim/dcemulator/net.py
@@ -282,7 +282,9 @@
#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
diff --git a/src/emuvim/dcemulator/prometheus.yml b/src/emuvim/dcemulator/prometheus.yml
index 4db5b6f..2412f85 100644
--- a/src/emuvim/dcemulator/prometheus.yml
+++ b/src/emuvim/dcemulator/prometheus.yml
@@ -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: