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] ] }