Skip to content

Commit

Permalink
[Metricbeat] Add new page statistics to system/memory metricset (elas…
Browse files Browse the repository at this point in the history
…tic#15492)

* add new page statistics to system/memory

* update field descriptions

* make update

* update data.json

* update system tests

* update changelog

* fix conflicts

* try to fix system python tests

(cherry picked from commit 0fd2250)
  • Loading branch information
fearful-symmetry committed Jan 14, 2020
1 parent bbbee6b commit 5bc5d5d
Show file tree
Hide file tree
Showing 7 changed files with 284 additions and 17 deletions.
89 changes: 89 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,95 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

*Metricbeat*

- Add AWS SQS metricset. {pull}10684[10684] {issue}10053[10053]
- Add AWS s3_request metricset. {pull}10949[10949] {issue}10055[10055]
- Add s3_daily_storage metricset. {pull}10940[10940] {issue}10055[10055]
- Add `coredns` metricbeat module. {pull}10585[10585]
- Add SSL support for Metricbeat HTTP server. {pull}11482[11482] {issue}11457[11457]
- The `elasticsearch.index` metricset (with `xpack.enabled: true`) now collects `refresh.external_total_time_in_millis` fields from Elasticsearch. {pull}11616[11616]
- Allow module configurations to have variants {pull}9118[9118]
- Add `timeseries.instance` field calculation. {pull}10293[10293]
- Added new disk states and raid level to the system/raid metricset. {pull}11613[11613]
- Added `path_name` and `start_name` to service metricset on windows module {issue}8364[8364] {pull}11877[11877]
- Add check on object name in the counter path if the instance name is missing {issue}6528[6528] {pull}11878[11878]
- Add AWS cloudwatch metricset. {pull}11798[11798] {issue}11734[11734]
- Add `regions` in aws module config to specify target regions for querying cloudwatch metrics. {issue}11932[11932] {pull}11956[11956]
- Keep `etcd` followers members from reporting `leader` metricset events {pull}12004[12004]
- Add overview dashboard to Consul module {pull}10665[10665]
- New fields were added in the mysql/status metricset. {pull}12227[12227]
- Add Kubernetes metricset `proxy`. {pull}12312[12312]
- Add Kubernetes proxy dashboard to Kubernetes module {pull}12734[12734]
- Always report Pod UID in the `pod` metricset. {pull}12345[12345]
- Add Vsphere Virtual Machine operating system to `os` field in Vsphere virtualmachine module. {pull}12391[12391]
- Add validation for elasticsearch and kibana modules' metricsets when xpack.enabled is set to true. {pull}12386[12386]
- Add CockroachDB module. {pull}12467[12467]
- Add support for metricbeat modules based on existing modules (a.k.a. light modules) {issue}12270[12270] {pull}12465[12465]
- Add a system/entropy metricset {pull}12450[12450]
- Add kubernetes metricset `controllermanager` {pull}12409[12409]
- Add Kubernetes controller manager dashboard to Kubernetes module {pull}12744[12744]
- Allow redis URL format in redis hosts config. {pull}12408[12408]
- Add tags into ec2 metricset. {issue}[12263]12263 {pull}12372[12372]
- Add metrics to kubernetes apiserver metricset. {pull}12922[12922]
- Add kubernetes metricset `scheduler` {pull}12521[12521]
- Add Kubernetes scheduler dashboard to Kubernetes module {pull}12749[12749]
- Add `beat` module. {pull}12181[12181] {pull}12615[12615]
- Collect tags for cloudwatch metricset in aws module. {issue}[12263]12263 {pull}12480[12480]
- Add AWS RDS metricset. {pull}11620[11620] {issue}10054[10054]
- Add Oracle Module {pull}11890[11890]
- Add Oracle Tablespaces Dashboard {pull}12736[12736]
- Collect client provided name for rabbitmq connection. {issue}12851[12851] {pull}12852[12852]
- Add support to load default aws config file to get credentials. {pull}12727[12727] {issue}12708[12708]
- Add statistic option into cloudwatch metricset. {issue}12370[12370] {pull}12840[12840]
- Add support for kubernetes cronjobs {pull}13001[13001]
- Add cgroup memory stats to docker/memory metricset {pull}12916[12916]
- Add AWS elb metricset. {pull}12952[12952] {issue}11701[11701]
- Add AWS ebs metricset. {pull}13167[13167] {issue}11699[11699]
- Add `metricset.period` field with the configured fetching period. {pull}13242[13242] {issue}12616[12616]
- Add rate metrics for ec2 metricset. {pull}13203[13203]
- Add refresh list of perf counters at every fetch {issue}13091[13091]
- Add Performance metricset to Oracle module {pull}12547[12547]
- Add proc/vmstat data to the system/memory metricset on linux {pull}13322[13322]
- Use DefaultMetaGeneratorConfig in MetadataEnrichers to initialize configurations {pull}13414[13414]
- Add module for statsd. {pull}13109[13109]
- Add support for NATS version 2. {pull}13601[13601]
- Add `docker.cpu.*.norm.pct` metrics for `cpu` metricset of Docker Metricbeat module. {pull}13695[13695]
- Add `instance` label by default when using Prometheus collector. {pull}13737[13737]
- Add azure module. {pull}13196[13196] {pull}13859[13859] {pull}13988[13988]
- Add Apache Tomcat module {pull}13491[13491]
- Add ECS `container.id` and `container.runtime` to kubernetes `state_container` metricset. {pull}13884[13884]
- Add `job` label by default when using Prometheus collector. {pull}13878[13878]
- Add `state_resourcequota` metricset for Kubernetes module. {pull}13693[13693]
- Add tags filter in ec2 metricset. {pull}13872[13872] {issue}13145[13145]
- Add cloud.account.id and cloud.account.name into events from aws module. {issue}13551[13551] {pull}13558[13558]
- Add `metrics_path` as known hint for autodiscovery {pull}13996[13996]
- Leverage KUBECONFIG when creating k8s client. {pull}13916[13916]
- Add ability to filter by tags for cloudwatch metricset. {pull}13758[13758] {issue}13145[13145]
- Release cloudwatch, s3_daily_storage, s3_request, sqs and rds metricset as GA. {pull}14114[14114] {issue}14059[14059]
- Add Oracle overview dashboard {pull}14021[14021]
- Release CoreDNS module as GA. {pull}14308[14308]
- Release CouchDB module as GA. {pull}14300[14300]
- Add `elasticsearch/enrich` metricset. {pull}14243[14243] {issue}14221[14221]
- Add support for Application ELB and Network ELB. {pull}14123[14123] {issue}13538[13538] {issue}13539[13539]
- Release aws ebs metricset as GA. {pull}14312[14312] {issue}14060[14060]
- Add `connection.state` field for RabbitMQ module. {pull}13981[13981]
- Add more TCP states to Metricbeat system socket_summary. {pull}14347[14347]
- Add Kafka JMX metricsets. {pull}14330[14330]
- Add metrics to envoyproxy server metricset and support for envoy proxy 1.12. {pull}14416[14416] {issue}13642[13642]
- Release kubernetes modules `controllermanager`, `scheduler`, `proxy`, `state_cronjob` and `state_resourcequota` as GA. {pull}14584[14584]
- Add module for ActiveMQ. {pull}14580[14580]
- Enable script processor. {pull}14711[14711]
- Enable wildcard for cloudwatch metricset namespace. {pull}14971[14971] {issue}14965[14965]
- Add `kube-state-metrics` `state_service` metrics for kubernetes module. {pull}14794[14794]
- Add `kube-state-metrics` `state_persistentvolume` metrics for kubernetes module. {pull}14859[14859]
- Add `kube-state-metrics` `state_persistentvolumeclaim` metrics for kubernetes module. {pull}15066[15066]
- Add usage metricset in aws modules. {pull}14925[14925] {issue}14935[14935]
- Add billing metricset in aws modules. {pull}14801[14801] {issue}14934[14934]
- Add AWS SNS metricset. {pull}14946[14946]
- Add overview dashboard for AWS SNS module {pull}14977[14977]
- Add `index` option to all modules to specify a module-specific output index. {pull}15100[15100]
- Add a `system/service` metricset for systemd data. {pull}14206[14206]
- Expand data for the `system/memory` metricset {pull}15492[15492]
- Add azure `storage` metricset in order to retrieve metric values for storage accounts. {issue}14548[14548] {pull}15342[15342]
- Add cost warnings for the azure module. {pull}15356[15356]
- Release elb module as GA. {pull}15485[15485]
- Add a `system/network_summary` metricset {pull}15196[15196]
Expand Down
83 changes: 83 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30398,6 +30398,89 @@ type: long
The percentage of used swap memory.
type: scaled_float
format: percent
--
[float]
=== page_stats
memory page statistics
*`system.memory.page_stats.pgscan_kswapd.pages`*::
+
--
pages scanned by kswapd
type: long
format: number
--
*`system.memory.page_stats.pgscan_direct.pages`*::
+
--
pages scanned directly
type: long
format: number
--
*`system.memory.page_stats.pgfree.pages`*::
+
--
pages freed by the system
type: long
format: number
--
*`system.memory.page_stats.pgsteal_kswapd.pages`*::
+
--
number of pages reclaimed by kswapd
type: long
format: number
--
*`system.memory.page_stats.pgsteal_direct.pages`*::
+
--
number of pages reclaimed directly
type: long
format: number
--
*`system.memory.page_stats.direct_efficiency.pct`*::
+
--
direct reclaim efficiency percentage. A lower percentage indicates the system is struggling to reclaim memory.
type: scaled_float
format: percent
--
*`system.memory.page_stats.kswapd_efficiency.pct`*::
+
--
kswapd reclaim efficiency percentage. A lower percentage indicates the system is struggling to reclaim memory.
type: scaled_float
format: percent
Expand Down
4 changes: 4 additions & 0 deletions metricbeat/module/system/fields.go

Large diffs are not rendered by default.

56 changes: 40 additions & 16 deletions metricbeat/module/system/memory/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@
"module": "system"
},
"metricset": {
"name": "memory"
"name": "memory",
"period": 10000
},
"service": {
"type": "system"
},
"system": {
"memory": {
"actual": {
"free": 671084544,
"free": 14247317504,
"used": {
"bytes": 362037248,
"pct": 0.3504
"bytes": 1407057920,
"pct": 0.0899
}
},
"free": 340848640,
"free": 4859097088,
"hugepages": {
"default_size": 2097152,
"free": 0,
Expand All @@ -38,28 +39,51 @@
"pct": 0
}
},
"page_stats": {
"direct_efficiency": {
"pct": 0.9976
},
"kswapd_efficiency": {
"pct": 0.6213
},
"pgfree": {
"pages": 4382105954
},
"pgscan_direct": {
"pages": 485820
},
"pgscan_kswapd": {
"pages": 77390925
},
"pgsteal_direct": {
"pages": 484631
},
"pgsteal_kswapd": {
"pages": 48081976
}
},
"swap": {
"free": 0,
"free": 7846490112,
"in": {
"pages": 0
"pages": 1111
},
"out": {
"pages": 0
"pages": 20255
},
"readahead": {
"cached": 0,
"pages": 0
"cached": 28,
"pages": 65
},
"total": 0,
"total": 7897870336,
"used": {
"bytes": 0,
"pct": 0
"bytes": 51380224,
"pct": 0.0065
}
},
"total": 1033121792,
"total": 15654375424,
"used": {
"bytes": 692273152,
"pct": 0.6701
"bytes": 10795278336,
"pct": 0.6896
}
}
}
Expand Down
33 changes: 33 additions & 0 deletions metricbeat/module/system/memory/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,39 @@
description: >
The percentage of used swap memory.
- name: page_stats
type: group
description: memory page statistics
fields:
- name: pgscan_kswapd.pages
type: long
format: number
description: pages scanned by kswapd
- name: pgscan_direct.pages
type: long
format: number
description: pages scanned directly
- name: pgfree.pages
type: long
format: number
description: pages freed by the system
- name: pgsteal_kswapd.pages
type: long
format: number
description: number of pages reclaimed by kswapd
- name: pgsteal_direct.pages
type: long
format: number
description: number of pages reclaimed directly
- name: direct_efficiency.pct
type: scaled_float
format: percent
description: direct reclaim efficiency percentage. A lower percentage indicates the system is struggling to reclaim memory.
- name: kswapd_efficiency.pct
type: scaled_float
format: percent
description: kswapd reclaim efficiency percentage. A lower percentage indicates the system is struggling to reclaim memory.

- name: hugepages
type: group
prefix: "[float]"
Expand Down
31 changes: 31 additions & 0 deletions metricbeat/module/system/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,38 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error {
"pages": vmstat.SwapRa,
"cached": vmstat.SwapRaHit,
}
pageStats := common.MapStr{
"pgscan_kswapd": common.MapStr{
"pages": vmstat.PgscanKswapd,
},
"pgscan_direct": common.MapStr{
"pages": vmstat.PgscanDirect,
},
"pgfree": common.MapStr{
"pages": vmstat.Pgfree,
},
"pgsteal_kswapd": common.MapStr{
"pages": vmstat.PgstealKswapd,
},
"pgsteal_direct": common.MapStr{
"pages": vmstat.PgstealDirect,
},
}
// This is similar to the vmeff stat gathered by sar
// these ratios calculate thhe efficiency of page reclaim
if vmstat.PgscanDirect != 0 {
pageStats["direct_efficiency"] = common.MapStr{
"pct": common.Round(float64(vmstat.PgstealDirect)/float64(vmstat.PgscanDirect), common.DefaultDecimalPlacesCount),
}
}

if vmstat.PgscanKswapd != 0 {
pageStats["kswapd_efficiency"] = common.MapStr{
"pct": common.Round(float64(vmstat.PgstealKswapd)/float64(vmstat.PgscanKswapd), common.DefaultDecimalPlacesCount),
}
}

memory["page_stats"] = pageStats
}

memory["swap"] = swap
Expand Down
5 changes: 4 additions & 1 deletion metricbeat/module/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
SYSTEM_FSSTAT_FIELDS = ["count", "total_files", "total_size"]

SYSTEM_MEMORY_FIELDS = ["swap", "actual.free", "free", "total", "used.bytes", "used.pct", "actual.used.bytes",
"actual.used.pct", "hugepages"]
"actual.used.pct", "hugepages", "page_stats"]

SYSTEM_NETWORK_FIELDS = ["name", "out.bytes", "in.bytes", "out.packets",
"in.packets", "in.error", "out.error", "in.dropped", "out.dropped"]
Expand Down Expand Up @@ -294,6 +294,9 @@ def test_memory(self):
if not re.match("(?i)linux", sys.platform) and not "hugepages" in memory:
# Ensure presence of hugepages only in Linux
memory["hugepages"] = None
if not re.match("(?i)linux", sys.platform) and not "page_stats" in memory:
# Ensure presence of page_stats only in Linux
memory["page_stats"] = None
self.assertItemsEqual(self.de_dot(SYSTEM_MEMORY_FIELDS), memory.keys())

# Check that percentages are calculated.
Expand Down

0 comments on commit 5bc5d5d

Please sign in to comment.