summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bae21de)
raw | patch | inline | side by side (parent: bae21de)
author | Blake Matheny <bmatheny@mobocracy.net> | |
Wed, 6 Feb 2013 12:04:47 +0000 (07:04 -0500) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Wed, 17 Jul 2013 07:57:23 +0000 (09:57 +0200) |
src/memcached.c | patch | blob | history |
diff --git a/src/memcached.c b/src/memcached.c
index a09f45ec6dae1a2e537fe986af7677f4130bd662..535ea84704b3dac328a5af495f69bccdbdfedb9a 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
gauge_t bytes_total = NAN;
gauge_t hits = NAN;
gauge_t gets = NAN;
+ gauge_t incr_hits = NAN;
+ derive_t incr = 0;
+ gauge_t decr_hits = NAN;
+ derive_t decr = 0;
derive_t rusage_user = 0;
derive_t rusage_syst = 0;
derive_t octets_rx = 0;
gets = atof (fields[2]);
}
+ /*
+ * Increment/Decrement
+ */
+ else if (FIELD_IS("incr_misses"))
+ {
+ derive_t incr_count = atoll (fields[2]);
+ submit_derive ("memcached_ops", "incr_misses", incr_count, st);
+ incr += incr_count;
+ }
+ else if (FIELD_IS ("incr_hits"))
+ {
+ derive_t incr_count = atoll (fields[2]);
+ submit_derive ("memcached_ops", "incr_hits", incr_count, st);
+ incr_hits = atof (fields[2]);
+ incr += incr_count;
+ }
+ else if (FIELD_IS ("decr_misses"))
+ {
+ derive_t decr_count = atoll (fields[2]);
+ submit_derive ("memcached_ops", "decr_misses", decr_count, st);
+ decr += decr_count;
+ }
+ else if (FIELD_IS ("decr_hits"))
+ {
+ derive_t decr_count = atoll (fields[2]);
+ submit_derive ("memcached_ops", "decr_hits", decr_count, st);
+ decr_hits = atof (fields[2]);
+ decr += decr_count;
+ }
+
/*
* Operations on the cache, i. e. cache hits, cache misses and evictions of items
*/
submit_gauge ("percent", "hitratio", rate, st);
}
+ if (!isnan (incr_hits) && incr != 0)
+ {
+ gauge_t incr_rate = 100.0 * incr_hits / incr;
+ submit_gauge ("percent", "incr_hitratio", incr_rate, st);
+ submit_derive ("memcached_ops", "incr", incr, st);
+ }
+
+ if (!isnan (decr_hits) && decr != 0)
+ {
+ gauge_t decr_rate = 100.0 * decr_hits / decr;
+ submit_gauge ("percent", "decr_hitratio", decr_rate, st);
+ submit_derive ("memcached_ops", "decr", decr, st);
+ }
+
return 0;
} /* int memcached_read */