#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
"--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
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: