Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add memcached module with stats metricset #3693

Merged
merged 2 commits into from
Mar 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
- The Docker, Kafka, and Prometheus modules are now Beta, instead of experimental. {pull}3525[3525]
- The HAProxy module is now GA, instead of experimental. {pull}3525[3525]
- Add the ability to collect the environment variables from system processes. {pull}3337[3337]
- Add memcached module with stats metricset. {pull}3693[3693]

*Packetbeat*
- Add `fields` and `fields_under_root` to packetbeat protocols configurations. {pull}3518[3518]
Expand Down
5 changes: 5 additions & 0 deletions metricbeat/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
- ${PWD}/module/haproxy/_meta/env
- ${PWD}/module/jolokia/_meta/env
- ${PWD}/module/kafka/_meta/env
- ${PWD}/module/memcached/_meta/env
- ${PWD}/module/mongodb/_meta/env
- ${PWD}/module/mysql/_meta/env
- ${PWD}/module/nginx/_meta/env
Expand All @@ -42,6 +43,7 @@ services:
haproxy: { condition: service_healthy }
jolokia: { condition: service_healthy }
kafka: { condition: service_healthy }
memcached: { condition: service_healthy }
mongodb: { condition: service_healthy }
mysql: { condition: service_healthy }
nginx: { condition: service_healthy }
Expand Down Expand Up @@ -70,6 +72,9 @@ services:
kafka:
build: ${PWD}/module/kafka/_meta

memcached:
build: ${PWD}/module/memcached/_meta

mongodb:
build: ${PWD}/module/mongodb/_meta

Expand Down
134 changes: 134 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ grouped in the following categories:
* <<exported-fields-haproxy>>
* <<exported-fields-jolokia>>
* <<exported-fields-kafka>>
* <<exported-fields-memcached>>
* <<exported-fields-mongodb>>
* <<exported-fields-mysql>>
* <<exported-fields-nginx>>
Expand Down Expand Up @@ -3321,6 +3322,139 @@ type: keyword
Broker address


[[exported-fields-memcached]]
== memcached Fields

[]beta
memcached Module



[float]
== memcached Fields




[float]
== stats Fields

stats



[float]
=== memcached.stats.pid

type: long

Current process ID of the Memcached task.


[float]
=== memcached.stats.uptime.sec

type: long

Memcached server uptime.


[float]
=== memcached.stats.threads

type: long

Number of threads used by the current Memcached server process.


[float]
=== memcached.stats.connections.current

type: long

Number of open connections to this Memcached server, should be the same value on all servers during normal operation.


[float]
=== memcached.stats.connections.total

type: long

Numer of successful connect attempts to this server since it has been started.


[float]
=== memcached.stats.get.hits

type: long

Number of successful "get" commands (cache hits) since startup, divide them by the "cmd_get" value to get the cache hitrate.


[float]
=== memcached.stats.get.misses

type: long

Number of failed "get" requests because nothing was cached for this key or the cached value was too old.


[float]
=== memcached.stats.cmd.get

type: long

Number of "get" commands received since server startup not counting if they were successful or not.


[float]
=== memcached.stats.cmd.set

type: long

Number of "set" commands serviced since startup.


[float]
=== memcached.stats.read.bytes

type: long

Total number of bytes received from the network by this server.


[float]
=== memcached.stats.written.bytes

type: long

Total number of bytes send to the network by this server.


[float]
=== memcached.stats.items.current

type: long

Number of items currently in this server's cache.


[float]
=== memcached.stats.items.total

type: long

Number of items stored ever stored on this server. This is no "maximum item count" value but a counted increased by every new item stored in the cache.


[float]
=== memcached.stats.evictions

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).


[[exported-fields-mongodb]]
== MongoDB Fields

Expand Down
37 changes: 37 additions & 0 deletions metricbeat/docs/modules/memcached.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
////
This file is generated! See scripts/docs_collector.py
////

[[metricbeat-module-memcached]]
== memcached Module

This is the memcached Module. These metricsets were tested with memcached version 1.4.35.



[float]
=== Example Configuration

The memcached module supports the standard configuration options that are described
in <<configuration-metricbeat>>. Here is an example configuration:

[source,yaml]
----
metricbeat.modules:
- module: memcached
metricsets: ["stats"]
enabled: true
period: 10s
hosts: ["localhost:11211"]

----

[float]
=== Metricsets

The following metricsets are available:

* <<metricbeat-metricset-memcached-stats,stats>>

include::memcached/stats.asciidoc[]

19 changes: 19 additions & 0 deletions metricbeat/docs/modules/memcached/stats.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
////
This file is generated! See scripts/docs_collector.py
////

[[metricbeat-metricset-memcached-stats]]
include::../../../module/memcached/stats/_meta/docs.asciidoc[]


==== Fields

For a description of each field in the metricset, see the
<<exported-fields-memcached,exported fields>> section.

Here is an example document generated by this metricset:

[source,json]
----
include::../../../module/memcached/stats/_meta/data.json[]
----
2 changes: 2 additions & 0 deletions metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This file is generated! See scripts/docs_collector.py
* <<metricbeat-module-haproxy,HAProxy>>
* <<metricbeat-module-jolokia,Jolokia>>
* <<metricbeat-module-kafka,kafka>>
* <<metricbeat-module-memcached,memcached>>
* <<metricbeat-module-mongodb,MongoDB>>
* <<metricbeat-module-mysql,MySQL>>
* <<metricbeat-module-nginx,Nginx>>
Expand All @@ -31,6 +32,7 @@ include::modules/golang.asciidoc[]
include::modules/haproxy.asciidoc[]
include::modules/jolokia.asciidoc[]
include::modules/kafka.asciidoc[]
include::modules/memcached.asciidoc[]
include::modules/mongodb.asciidoc[]
include::modules/mysql.asciidoc[]
include::modules/nginx.asciidoc[]
Expand Down
2 changes: 2 additions & 0 deletions metricbeat/include/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import (
_ "github.com/elastic/beats/metricbeat/module/kafka"
_ "github.com/elastic/beats/metricbeat/module/kafka/consumergroup"
_ "github.com/elastic/beats/metricbeat/module/kafka/partition"
_ "github.com/elastic/beats/metricbeat/module/memcached"
_ "github.com/elastic/beats/metricbeat/module/memcached/stats"
_ "github.com/elastic/beats/metricbeat/module/mongodb"
_ "github.com/elastic/beats/metricbeat/module/mongodb/dbstats"
_ "github.com/elastic/beats/metricbeat/module/mongodb/status"
Expand Down
8 changes: 8 additions & 0 deletions metricbeat/metricbeat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ metricbeat.modules:
#username: ""
#password: ""

#------------------------------ memcached Module -----------------------------
- module: memcached
metricsets: ["stats"]
enabled: true
period: 10s
hosts: ["localhost:11211"]


#------------------------------- MongoDB Module ------------------------------
#- module: mongodb
#metricsets: ["dbstats", "status"]
Expand Down
8 changes: 8 additions & 0 deletions metricbeat/module/memcached/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM memcached:1.4.35-alpine

USER root
RUN apk update
RUN apk add netcat-openbsd
USER memcache

HEALTHCHECK CMD nc -z localhost 11211
6 changes: 6 additions & 0 deletions metricbeat/module/memcached/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- module: memcached
metricsets: ["stats"]
enabled: true
period: 10s
hosts: ["localhost:11211"]

4 changes: 4 additions & 0 deletions metricbeat/module/memcached/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
== memcached Module

This is the memcached Module. These metricsets were tested with memcached version 1.4.35.

2 changes: 2 additions & 0 deletions metricbeat/module/memcached/_meta/env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MEMCACHED_HOST=memcached
MEMCACHED_PORT=11211
12 changes: 12 additions & 0 deletions metricbeat/module/memcached/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- key: memcached
title: "memcached"
description: >
[]beta

memcached Module
short_config: false
fields:
- name: memcached
type: group
description: >
fields:
4 changes: 4 additions & 0 deletions metricbeat/module/memcached/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
Package memcached is a Metricbeat module that contains MetricSets.
*/
package memcached
46 changes: 46 additions & 0 deletions metricbeat/module/memcached/stats/_meta/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"@timestamp": "2016-05-23T08:05:34.853Z",
"beat": {
"hostname": "host.example.com",
"name": "host.example.com"
},
"memcached": {
"stats": {
"cmd": {
"get": 0,
"set": 0
},
"connections": {
"current": 10,
"total": 11
},
"evictions": 0,
"get": {
"hits": 0,
"misses": 0
},
"items": {
"current": 0,
"total": 0
},
"pid": 1,
"read": {
"bytes": 6
},
"threads": 4,
"uptime": {
"sec": 7
},
"written": {
"bytes": 0
}
}
},
"metricset": {
"host": "127.0.0.1:11211",
"module": "memcached",
"name": "stats",
"rtt": 115
},
"type": "metricsets"
}
3 changes: 3 additions & 0 deletions metricbeat/module/memcached/stats/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
=== memcached stats MetricSet

This is the stats metricset of the module memcached.
Loading