Added memcached_instance column to published data.

This commit is contained in:
Connor Doyle 2015-08-17 13:17:47 -07:00
parent 6ec25da58f
commit b7954d7633
2 changed files with 10 additions and 5 deletions

View File

@ -48,9 +48,12 @@ Posting metrics to influxdb
## Querying data from InfluxDB ## Querying data from InfluxDB
Simplest example: Simple example:
```sql ```sql
SELECT value from memcached_rps; SELECT value from memcached_rps
WHERE time > now() - 10m
AND "memcached_instance"='localhost:11211'
LIMIT 25;
``` ```

View File

@ -144,16 +144,18 @@ def extract_rps(raw_stats):
return requests_per_second return requests_per_second
def post_to_influxdb(rps): 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" print "Posting metrics to influxdb"
samples = [] samples = []
rps_sample = { rps_sample = {
"name": "memcached_rps", "name": "memcached_rps",
"columns": [ "value" ], "columns": [ "value", "memcached_instance" ],
"points": [ "points": [
[rps] [rps, memcached_instance]
] ]
} }