From b7954d7633a0309ee32afc4a59f7a9c4fc55d20a Mon Sep 17 00:00:00 2001 From: Connor Doyle Date: Mon, 17 Aug 2015 13:17:47 -0700 Subject: [PATCH] Added memcached_instance column to published data. --- metrics/m2i/README.md | 7 +++++-- metrics/m2i/m2i.py | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/metrics/m2i/README.md b/metrics/m2i/README.md index 1c98645..0efd9e7 100644 --- a/metrics/m2i/README.md +++ b/metrics/m2i/README.md @@ -48,9 +48,12 @@ Posting metrics to influxdb ## Querying data from InfluxDB -Simplest example: +Simple example: ```sql -SELECT value from memcached_rps; +SELECT value from memcached_rps + WHERE time > now() - 10m + AND "memcached_instance"='localhost:11211' + LIMIT 25; ``` diff --git a/metrics/m2i/m2i.py b/metrics/m2i/m2i.py index 3063d75..8e1afa0 100755 --- a/metrics/m2i/m2i.py +++ b/metrics/m2i/m2i.py @@ -144,16 +144,18 @@ def extract_rps(raw_stats): return requests_per_second def post_to_influxdb(rps): - global influxdb_endpoint + global influxdb_endpoint, memcached_host, memcached_port + + memcached_instance = "{}:{}".format(memcached_host, memcached_port) print "Posting metrics to influxdb" samples = [] rps_sample = { "name": "memcached_rps", - "columns": [ "value" ], + "columns": [ "value", "memcached_instance" ], "points": [ - [rps] + [rps, memcached_instance] ] }