# Add memory-usage metrics to schema of memcached-module of metricbeats

**URL:** <https://discuss.elastic.co/t/add-memory-usage-metrics-to-schema-of-memcached-module-of-metricbeats/140303>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [July 17, 2018, 10:05am UTC](https://discuss.elastic.co/t/add-memory-usage-metrics-to-schema-of-memcached-module-of-metricbeats/140303 "2018-07-17T10:05:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hooddominator](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@Hooddominator](https://discuss.elastic.co/u/Hooddominator)\
**Post date:** [July 17, 2018, 10:05am UTC](https://discuss.elastic.co/t/add-memory-usage-metrics-to-schema-of-memcached-module-of-metricbeats/140303/1 "2018-07-17T10:05:06Z")

</div>

To determ memory-usage of a memcached-instance it would be really helpfull if we can add two additional metrics which are allready present in scanned/parsed "stats"-data of memcached. The field with key " limit\_maxbytes" contains the maximum defined memory for the instance and the field with key "bytes" contains the currently used memory. If we add these fields to the scheme which is used for mapping by the scanner, we can calculate the used-memory against max memory of an instance (eg. as percental value by calculate _limit\_maxbytes / bytes \* 100_ in a pipeline via logstash or ingestnode). This metric would be ways more usefull to determ an instance which memory reaching max than notice occuring evictions - when max memory is allready reached...

```
schema = s.Schema{
	"pid": c.Int("pid"),
	"uptime": s.Object{
		"sec": c.Int("uptime"),
	},
	"threads": c.Int("threads"),
	"connections": s.Object{
		"current": c.Int("curr_connections"),
		"total": c.Int("total_connections"),
	},
	"get": s.Object{
		"hits": c.Int("get_hits"),
		"misses": c.Int("get_misses"),
	},
	"cmd": s.Object{
		"get": c.Int("cmd_get"),
		"set": c.Int("cmd_set"),
	},
	"read": s.Object{
		"bytes": c.Int("bytes_read"),
	},
	"written": s.Object{
		"bytes": c.Int("bytes_written"),
	},
	"items": s.Object{
		"current": c.Int("curr_items"),
		"total": c.Int("total_items"),
	},
	"evictions": c.Int("evictions"),
    "bytes": s.Object{
	 	"current": c.Int("bytes"),
	 	"max": c.Int("limit_maxbytes"),
	},
}
```

---

<div class="post-metadata">

**Author:** ![adrisr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adrisr/32/25423_2.png) [@adrisr](https://discuss.elastic.co/u/adrisr)\
**Post date:** [July 17, 2018, 11:00am UTC](https://discuss.elastic.co/t/add-memory-usage-metrics-to-schema-of-memcached-module-of-metricbeats/140303/2 "2018-07-17T11:00:58Z")

</div>

That's a great idea.

I suggest you either create an [enhancement request](https://github.com/elastic/beats/issues/new) in the Beats repo or, if you feel brave, [submit a pull request](https://www.elastic.co/guide/en/beats/devguide/current/beats-contributing.html) with the changes yourself.

---

<div class="post-metadata">

**Author:** ![Hooddominator](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@Hooddominator](https://discuss.elastic.co/u/Hooddominator)\
**Post date:** [July 17, 2018, 2:14pm UTC](https://discuss.elastic.co/t/add-memory-usage-metrics-to-schema-of-memcached-module-of-metricbeats/140303/3 "2018-07-17T14:14:00Z")

</div>

thanks, i forwarded this to github as issue #7618

---

<div class="post-metadata">

**Author:** ![Hooddominator](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@Hooddominator](https://discuss.elastic.co/u/Hooddominator)\
**Post date:** [July 26, 2018, 9:50am UTC](https://discuss.elastic.co/t/add-memory-usage-metrics-to-schema-of-memcached-module-of-metricbeats/140303/4 "2018-07-26T09:50:27Z")

</div>

Enhancement request seems to be implemented in future release - at least changes got merged in master.  
Thanks!

---

<div class="post-metadata">

**Author:** ![adrisr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adrisr/32/25423_2.png) [@adrisr](https://discuss.elastic.co/u/adrisr)\
**Post date:** [July 26, 2018, 10:31am UTC](https://discuss.elastic.co/t/add-memory-usage-metrics-to-schema-of-memcached-module-of-metricbeats/140303/5 "2018-07-26T10:31:30Z")

</div>

Thanks for your contribution @Hooddominator !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 23, 2018, 10:31am UTC](https://discuss.elastic.co/t/add-memory-usage-metrics-to-schema-of-memcached-module-of-metricbeats/140303/6 "2018-08-23T10:31:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
