From 60e8999da198f1c8c4242c8afc77e39a82b6e47f Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 26 Jul 2018 08:56:10 +0200 Subject: [PATCH] Metricbeat: Add memcached used bytes metrics (#7740) --- CHANGELOG.asciidoc | 1 + metricbeat/docs/fields.asciidoc | 20 +++++++++++++++++++ metricbeat/module/memcached/fields.go | 2 +- .../module/memcached/stats/_meta/data.json | 6 +++++- .../module/memcached/stats/_meta/fields.yml | 12 +++++++++++ metricbeat/module/memcached/stats/data.go | 4 ++++ 6 files changed, 43 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index b694e08212ab..760483280247 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -325,6 +325,7 @@ https://github.com/elastic/beats/compare/v6.2.3...master[Check the HEAD diff] - Release prometheus collector metricset as GA. {pull}7660[7660] - Add Elasticsearch `cluster_stats` metricset. {pull}7638[7638] - Added `basepath` setting for HTTP-based metricsets {pull}7700[7700] +- Add metrics about cache size to memcached module {pull}7740[7740] *Packetbeat* diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 130ed7bdd862..43a6644d2409 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -9684,6 +9684,26 @@ type: long Number of objects removed from the cache to free up memory for new items because Memcached reached it's maximum memory setting (limit_maxbytes). +-- + +*`memcached.stats.bytes.current`*:: ++ +-- +type: long + +Number of bytes currently used for caching items. + + +-- + +*`memcached.stats.bytes.limit`*:: ++ +-- +type: long + +Number of bytes this server is allowed to use for storage. + + -- [[exported-fields-mongodb]] diff --git a/metricbeat/module/memcached/fields.go b/metricbeat/module/memcached/fields.go index 3d7e97821009..2ad44bb92149 100644 --- a/metricbeat/module/memcached/fields.go +++ b/metricbeat/module/memcached/fields.go @@ -31,5 +31,5 @@ func init() { // Asset returns asset data func Asset() string { - return "eJzEVr12MycQ7fUUc9R89jn2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P8Wy5AHDINvtePKU1/LIAADi9h0iuBFwA8I6yvFhKnd+uoTOB9TRjQMO4hg2KWQB0HoPjdQX5AslEvCagjxx7XMM2U+mHkwcMrqEu4ViM8On0Edy/QrbnFuBWw/jcErgk0Xt3dT7SCJS2Ny++w0SfX0vOmAT6TBaZ4fffgDqQHV4EQQy/rk43HxIqvfiIK0Y7E6+zdca8xzxa+D4N2WU0jmfi8GeJG8zNHxUXCqODzbH6xw6eu2M6uHKCqqWU0KppXg1Qs9OmHtOlIRAC2Xm+4/xZ66sEBxus2thEvMPdm1AQKIEJYbjH4Er2aQuJcjRBDWajpt4gXkhMmE96U87Fagy6EkZbYEQw9nJ2whAu9skieIGdYdggJq3QLOgmNGxRVjsv8yfbBfflFmUJlmI0yTF8rEEDtfpp4F25lv4zOL/3rkYv3mEPGbu00b1UxBZKIRXRknkEzkamikyFR8+M80vvjA/oBtkZ/y7IokGxpjBCItlpsh0Mw5C+HeUWzFc83uHWdzh+2jTrXSECClPxtdGttjh/Ud7ENKNFv9dKbPEckrKFVSWDpZJEdfvamO91HjDjZdZQ1ntPyOMfIY+v5Kkeb8/ymq4JbtpsV5ujPJ9hnfYf0SH64NYE96/agCCdFFSIc1y6TLHmUUI5UH5t1XTqHxNSDtmLYHpvNYzJtcb3H3V4wfjjBlVFHydqOIJPl9Q+DOX+FMU3jZP/4+hb9iyU0QG28q3/05WMFXzVH54hESyj+eZjifXyHXYt+bFNb4qAaUfowCebdV+se4gaO0LCQ4UZzVbv4VM+w71vY/jneow2f6EVLbJIVzXW5pAQdBkRSq/bO+Vj7fOjzFurcBoQ57UmY/vr5QPD6OoBi1FqO/0YfPTyEs23quXThKvqR2+tgHnc1Wr4XB51DVWXqNo6GWrqP8O/an4P9pcrl2fdIemAtSdp5FSMZq/Z4mrxTwAAAP//OVbeqg==" } diff --git a/metricbeat/module/memcached/stats/_meta/data.json b/metricbeat/module/memcached/stats/_meta/data.json index 1ddf7d907a8e..540f45b0ca89 100644 --- a/metricbeat/module/memcached/stats/_meta/data.json +++ b/metricbeat/module/memcached/stats/_meta/data.json @@ -6,6 +6,10 @@ }, "memcached": { "stats": { + "bytes": { + "current": 0, + "limit": 67108864 + }, "cmd": { "get": 0, "set": 0 @@ -42,4 +46,4 @@ "name": "stats", "rtt": 115 } -} \ No newline at end of file +} diff --git a/metricbeat/module/memcached/stats/_meta/fields.yml b/metricbeat/module/memcached/stats/_meta/fields.yml index cdeee70f3209..35940c8751ce 100644 --- a/metricbeat/module/memcached/stats/_meta/fields.yml +++ b/metricbeat/module/memcached/stats/_meta/fields.yml @@ -83,3 +83,15 @@ description: > Number of objects removed from the cache to free up memory for new items because Memcached reached it's maximum memory setting (limit_maxbytes). + + - name: bytes.current + type: long + formate: bytes + description: > + Number of bytes currently used for caching items. + + - name: bytes.limit + type: long + formate: bytes + description: > + Number of bytes this server is allowed to use for storage. diff --git a/metricbeat/module/memcached/stats/data.go b/metricbeat/module/memcached/stats/data.go index be6224eab11c..e3b1b57ea0b5 100644 --- a/metricbeat/module/memcached/stats/data.go +++ b/metricbeat/module/memcached/stats/data.go @@ -52,5 +52,9 @@ var ( "total": c.Int("total_items"), }, "evictions": c.Int("evictions"), + "bytes": s.Object{ + "current": c.Int("bytes"), + "limit": c.Int("limit_maxbytes"), + }, } )