From 425ef9b2e5e196fba79735c7e152e0da77c9b5a3 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Thu, 12 Aug 2021 17:47:32 +0930 Subject: [PATCH 01/13] Adds new linux pressure metricset --- metricbeat/docs/fields.asciidoc | 17 +++ metricbeat/docs/modules/linux.asciidoc | 5 + .../docs/modules/linux/pressure.asciidoc | 23 ++++ metricbeat/docs/modules_list.asciidoc | 3 +- metricbeat/include/list_common.go | 1 + metricbeat/module/linux/_meta/config.yml | 1 + metricbeat/module/linux/fields.go | 2 +- .../module/linux/pressure/_meta/data.json | 92 +++++++++++++++ .../module/linux/pressure/_meta/docs.asciidoc | 1 + .../module/linux/pressure/_meta/fields.yml | 22 ++++ metricbeat/module/linux/pressure/pressure.go | 109 ++++++++++++++++++ .../module/linux/pressure/pressure_test.go | 37 ++++++ metricbeat/modules.d/linux.yml.disabled | 1 + 13 files changed, 312 insertions(+), 2 deletions(-) create mode 100644 metricbeat/docs/modules/linux/pressure.asciidoc create mode 100644 metricbeat/module/linux/pressure/_meta/data.json create mode 100644 metricbeat/module/linux/pressure/_meta/docs.asciidoc create mode 100644 metricbeat/module/linux/pressure/_meta/fields.yml create mode 100644 metricbeat/module/linux/pressure/pressure.go create mode 100644 metricbeat/module/linux/pressure/pressure_test.go diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index a37898676cd9..63fd4705f97d 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -39019,6 +39019,23 @@ type: object -- +[float] +=== pressure + +pressure + + + +*`linux.pressure.example`*:: ++ +-- +Example field + + +type: keyword + +-- + [[exported-fields-logstash]] == Logstash fields diff --git a/metricbeat/docs/modules/linux.asciidoc b/metricbeat/docs/modules/linux.asciidoc index ab911885afd3..ffbd30fe9417 100644 --- a/metricbeat/docs/modules/linux.asciidoc +++ b/metricbeat/docs/modules/linux.asciidoc @@ -26,6 +26,7 @@ metricbeat.modules: # - ksm # - conntrack # - iostat + - "pressure" enabled: true #hostfs: /hostfs @@ -46,6 +47,8 @@ The following metricsets are available: * <> +* <> + include::linux/conntrack.asciidoc[] include::linux/iostat.asciidoc[] @@ -56,3 +59,5 @@ include::linux/memory.asciidoc[] include::linux/pageinfo.asciidoc[] +include::linux/pressure.asciidoc[] + diff --git a/metricbeat/docs/modules/linux/pressure.asciidoc b/metricbeat/docs/modules/linux/pressure.asciidoc new file mode 100644 index 000000000000..9a549746fa8f --- /dev/null +++ b/metricbeat/docs/modules/linux/pressure.asciidoc @@ -0,0 +1,23 @@ +//// +This file is generated! See scripts/mage/docs_collector.go +//// + +[[metricbeat-metricset-linux-pressure]] +=== linux pressure metricset + +beta[] + +include::../../../module/linux/pressure/_meta/docs.asciidoc[] + + +==== Fields + +For a description of each field in the metricset, see the +<> section. + +Here is an example document generated by this metricset: + +[source,json] +---- +include::../../../module/linux/pressure/_meta/data.json[] +---- diff --git a/metricbeat/docs/modules_list.asciidoc b/metricbeat/docs/modules_list.asciidoc index 3e2e0b7f5bfa..183170a44b79 100644 --- a/metricbeat/docs/modules_list.asciidoc +++ b/metricbeat/docs/modules_list.asciidoc @@ -186,11 +186,12 @@ This file is generated! See scripts/mage/docs_collector.go .2+| .2+| |<> beta[] |<> beta[] |<> beta[] |image:./images/icon-no.png[No prebuilt dashboards] | -.5+| .5+| |<> beta[] +.6+| .6+| |<> beta[] |<> beta[] |<> beta[] |<> beta[] |<> beta[] +|<> beta[] |<> |image:./images/icon-no.png[No prebuilt dashboards] | .2+| .2+| |<> |<> diff --git a/metricbeat/include/list_common.go b/metricbeat/include/list_common.go index 4ccbd78a325c..de7d7c96993f 100644 --- a/metricbeat/include/list_common.go +++ b/metricbeat/include/list_common.go @@ -100,6 +100,7 @@ import ( _ "github.com/elastic/beats/v7/metricbeat/module/linux/ksm" _ "github.com/elastic/beats/v7/metricbeat/module/linux/memory" _ "github.com/elastic/beats/v7/metricbeat/module/linux/pageinfo" + _ "github.com/elastic/beats/v7/metricbeat/module/linux/pressure" _ "github.com/elastic/beats/v7/metricbeat/module/logstash" _ "github.com/elastic/beats/v7/metricbeat/module/logstash/node" _ "github.com/elastic/beats/v7/metricbeat/module/logstash/node_stats" diff --git a/metricbeat/module/linux/_meta/config.yml b/metricbeat/module/linux/_meta/config.yml index 490d3245c19f..b0c9fb6a833f 100644 --- a/metricbeat/module/linux/_meta/config.yml +++ b/metricbeat/module/linux/_meta/config.yml @@ -6,6 +6,7 @@ # - ksm # - conntrack # - iostat + - "pressure" enabled: true #hostfs: /hostfs diff --git a/metricbeat/module/linux/fields.go b/metricbeat/module/linux/fields.go index f83e1b6e4254..4781625d383c 100644 --- a/metricbeat/module/linux/fields.go +++ b/metricbeat/module/linux/fields.go @@ -32,5 +32,5 @@ func init() { // AssetLinux returns asset data. // This is the base64 encoded zlib format compressed contents of module/linux. func AssetLinux() string { - return "eJzEmd9v2zgSx9/zVwwCHNAWVzfp7/rhgNylOBR3uQu27csudoUxObK5pkiVP+y6f/2CpBXLtmQrcaT6pWgkz3z4neHMkH4Oc1qNQQrlv58BOOEkjeE8/v/8DMCQJLQ0hgk5PAPgZJkRpRNajeEfZwCQvguF5l7SGUAuSHI7jo+eg8KCNubDx61KGsPUaF+u/9Jgc2PXrqyjAgpyRjC7flj3UffDtFLOIJvfPWnyFz6766o+LSzh02R8F6QOY31RoFltPWvDOeI6fNbmQOeg8uwOBqxDJ6wTzP49vkMckBltLfzr9iswbcju2GqCroNzo3fZNuRSq2nDwyPw4VMim5Oz0XxJHLgncHojK+QopPCGWsEIjVxlPeFtOEg5I2gD6jQUOCcwWheQawOKlqDVnq410GShB8qKTShwM6pBO5zIduVy7RXvAcd6xsja3Eu5Akto2Ix46/IrGjFVuiHMj5dilkgBSkPIV1EjYi4FEnfivLs9a5DKknFZSErqQ7r/+WJCJmznKqbLGRkCKaxbO6/+SQxwAHWBUpwIuW9+T1E3QwcMldIOJgRR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iL5/iATl8mduSnU52ly9C00ZvxvD+R9BhT/PD1X3L/5AEKwAU9L6Vl+p8r5P4fqXCA+yTmBnwolGVha3d/3R0hCssij63XZtDb2yoPWvU4VSojkRnaG09qapM3fTlztg38Qu7Bk8LQqh4iyyWUUL+aFd08Ldcbc0jHlbZ+CtLDo4KWt68Ph+2vzABXIR5ueHZoqmeFHyY/lLCpg4C1LZ2qTptiDjdCFcz22ybT1qQZqpPOdd0z6lDJ2wddd9ndGP2LLX0X28y8yUrmWuTulcZqqPk0ON7UMHholL01Wy84VmoA5qXKPFeHX+otCKvQgevINozHfDUNhiRk5WoHS6ly9tHeX65qoxyHXMHbgD+81VPPtcbx+52rCqaOcXuz14G68hBzsSBgpNBGzm5Nz4rfLyr4tnt1f//5h8/vT7x8Nol4OjXXZFezk42suuaK8GR3vVFe314Givu6K9GRztTVe0t4Ojve2K9m5wtHdd0d4Pjva+K9qHwdE+dC65w7eDy6Z+UEJJlZIZPavt+GryN+0dHjqQ/IbLcubkSkJo+JUpwHdV72Br0tgfjDQZs/2PLE83GO3bPjQY0R3mxd6PCpFmTqul0rsTf4tIH6PB6PTsnwAAAP//o6JopA==" } diff --git a/metricbeat/module/linux/pressure/_meta/data.json b/metricbeat/module/linux/pressure/_meta/data.json new file mode 100644 index 000000000000..5f7abf63a68b --- /dev/null +++ b/metricbeat/module/linux/pressure/_meta/data.json @@ -0,0 +1,92 @@ +{ + "@timestamp":"2016-05-23T08:05:34.853Z", + "beat":{ + "hostname":"beathost", + "name":"beathost" + }, + "metricset":{ + "host":"localhost", + "module":"linux", + "name":"pressure", + "rtt":44269 + }, + "linux":{ + "pressure":{ + "example": "pressure" + } + }, + "type":"metricsets" +} + + +{ + "@timestamp": "2021-08-12T06:16:57.057Z", + "@metadata": { + "beat": "metricbeat", + "type": "_doc", + "version": "8.0.0" + }, + "metricset": { + "name": "pressure", + "period": 10000 + }, + "service": { + "type": "linux" + }, + "ecs": { + "version": "1.10.0" + }, + "host": { + "ip": [ + "10.0.2.15", + "fe80::30:6ff:fee0:ff78" + ], + "mac": [ + "02:30:06:e0:ff:78" + ], + "name": "ubuntu-focal", + "hostname": "ubuntu-focal", + "architecture": "x86_64", + "os": { + "name": "Ubuntu", + "kernel": "5.4.0-80-generic", + "codename": "focal", + "type": "linux", + "platform": "ubuntu", + "version": "20.04.2 LTS (Focal Fossa)", + "family": "debian" + }, + "id": "a69be1f9fdda4e348cb3e682eb1085f1", + "containerized": false + }, + "agent": { + "ephemeral_id": "7afcb844-d7bb-46fa-82bd-738e69a16991", + "id": "715455b0-aacd-43b3-8a12-48c8fec62d2c", + "name": "ubuntu-focal", + "type": "metricbeat", + "version": "8.0.0" + }, + "linux": { + "pressure": { + "io": { + "some": { + "10": 0, + "60": 0, + "300": 0, + "total": 163773245 + }, + "full": { + "total": 154202053, + "10": 0, + "60": 0, + "300": 0 + } + } + } + }, + "event": { + "duration": 204672, + "dataset": "linux.pressure", + "module": "linux" + } +} diff --git a/metricbeat/module/linux/pressure/_meta/docs.asciidoc b/metricbeat/module/linux/pressure/_meta/docs.asciidoc new file mode 100644 index 000000000000..ac5b4dd8ae64 --- /dev/null +++ b/metricbeat/module/linux/pressure/_meta/docs.asciidoc @@ -0,0 +1 @@ +This is the pressure metricset of the module linux. diff --git a/metricbeat/module/linux/pressure/_meta/fields.yml b/metricbeat/module/linux/pressure/_meta/fields.yml new file mode 100644 index 000000000000..54c0c7137d2c --- /dev/null +++ b/metricbeat/module/linux/pressure/_meta/fields.yml @@ -0,0 +1,22 @@ +- name: pressure + type: group + release: beta + description: > + Linux pressure stall information metrics for cpu, memory, and io + fields: + - name: pressure + type: group + description: Linux pressure stall information + fields: + - name: cpu.some.10 + type: float + description: cpu pressure stall information + - name: cpu.some.60 + type: float + description: cpu pressure stall information + - name: cpu.some.300 + type: float + description: cpu pressure stall information + - name: cpu.some.total + type: float + description: cpu pressure stall information diff --git a/metricbeat/module/linux/pressure/pressure.go b/metricbeat/module/linux/pressure/pressure.go new file mode 100644 index 000000000000..f94dfd05de95 --- /dev/null +++ b/metricbeat/module/linux/pressure/pressure.go @@ -0,0 +1,109 @@ +package pressure + +import ( + "fmt" + "runtime" + + "github.com/elastic/beats/v7/libbeat/common" + "github.com/elastic/beats/v7/libbeat/common/cfgwarn" + "github.com/elastic/beats/v7/metricbeat/mb" + "github.com/pkg/errors" + "github.com/prometheus/procfs" +) + +const ( + moduleName = "linux" + metricsetName = "pressure" +) + +// init registers the MetricSet with the central registry as soon as the program +// starts. The New function will be called later to instantiate an instance of +// the MetricSet for each host defined in the module's configuration. After the +// MetricSet has been created then Fetch will begin to be called periodically. +func init() { + mb.Registry.MustAddMetricSet("linux", "pressure", New) +} + +// MetricSet holds any configuration or state information. It must implement +// the mb.MetricSet interface. And this is best achieved by embedding +// mb.BaseMetricSet because it implements all of the required mb.MetricSet +// interface methods except for Fetch. +type MetricSet struct { + mb.BaseMetricSet + fs procfs.FS +} + +// New creates a new instance of the MetricSet. New is responsible for unpacking +// any MetricSet specific configuration options if there are any. +func New(base mb.BaseMetricSet) (mb.MetricSet, error) { + cfgwarn.Beta("The linux pressure metricset is beta.") + + if runtime.GOOS != "linux" { + return nil, fmt.Errorf("the %v/%v metricset is only supported on Linux", moduleName, metricsetName) + } + + config := struct{}{} + if err := base.Module().UnpackConfig(&config); err != nil { + return nil, err + } + + fs, err := procfs.NewFS("/proc") + if err != nil { + return nil, errors.Wrap(err, "error getting procfs") + } + + return &MetricSet{ + BaseMetricSet: base, + fs: fs, + }, nil +} + +// Fetch methods implements the data gathering and data conversion to the right +// format. It publishes the event which is then forwarded to the output. In case +// of an error set the Error field of mb.Event or simply call report.Error(). +func (m *MetricSet) Fetch(report mb.ReporterV2) error { + events, err := FetchLinuxPSIStats(m) + if err != nil { + return errors.Wrap(err, "error fetching PSI stats") + } + + for _, event := range events { + report.Event(mb.Event{ + MetricSetFields: event, + }) + } + return nil +} + +func FetchLinuxPSIStats(m *MetricSet) ([]common.MapStr, error) { + resources := []string{"cpu", "memory", "io"} + events := []common.MapStr{} + + for _, resource := range resources { + psiMetric, err := m.fs.PSIStatsForResource(resource) + if err != nil { + return nil, errors.Wrap(err, "could not retrieve PSI stats for"+resource) + } + + event := common.MapStr{ + resource: common.MapStr{ + "some": common.MapStr{ + "10": psiMetric.Some.Avg10, + "60": psiMetric.Some.Avg60, + "300": psiMetric.Some.Avg300, + "total": psiMetric.Some.Total, + }, + }, + } + // /proc/pressure/cpu does not contain 'full' metrics + if resource != "cpu" { + event.Put(resource+".full.10", psiMetric.Full.Avg10) + event.Put(resource+".full.60", psiMetric.Full.Avg60) + event.Put(resource+".full.300", psiMetric.Full.Avg300) + event.Put(resource+".full.total", psiMetric.Full.Total) + } + + events = append(events, event) + } + return events, nil +} diff --git a/metricbeat/module/linux/pressure/pressure_test.go b/metricbeat/module/linux/pressure/pressure_test.go new file mode 100644 index 000000000000..42b36a6dac7c --- /dev/null +++ b/metricbeat/module/linux/pressure/pressure_test.go @@ -0,0 +1,37 @@ +package pressure + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing" +) + +func TestFetch(t *testing.T) { + f := mbtest.NewReportingMetricSetV2Error(t, getConfig()) + events, errs := mbtest.ReportingFetchV2Error(f) + + assert.Empty(t, errs) + if !assert.NotEmpty(t, events) { + t.FailNow() + } + + t.Logf("%s/%s event: %+v", f.Module().Name(), f.Name(), + events[0].BeatEvent("linux", "pressure").Fields.StringToPrint()) +} + +func TestData(t *testing.T) { + f := mbtest.NewReportingMetricSetV2Error(t, getConfig()) + err := mbtest.WriteEventsReporterV2Error(f, t, ".") + if err != nil { + t.Fatal("write", err) + } +} + +func getConfig() map[string]interface{} { + return map[string]interface{}{ + "module": "linux", + "metricsets": []string{"pressure"}, + } +} diff --git a/metricbeat/modules.d/linux.yml.disabled b/metricbeat/modules.d/linux.yml.disabled index 22e675cafffa..2f2b9aeb9099 100644 --- a/metricbeat/modules.d/linux.yml.disabled +++ b/metricbeat/modules.d/linux.yml.disabled @@ -9,6 +9,7 @@ # - ksm # - conntrack # - iostat + - "pressure" enabled: true #hostfs: /hostfs From c6a1ce0768d067638c21e3172bcd70c64acd1c45 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Fri, 13 Aug 2021 13:33:03 +0930 Subject: [PATCH 02/13] Tidy up code --- .../module/linux/pressure/_meta/data.json | 94 ++++--------------- .../module/linux/pressure/_meta/docs.asciidoc | 2 +- .../module/linux/pressure/_meta/fields.yml | 76 ++++++++++++++- metricbeat/module/linux/pressure/pressure.go | 11 +-- metricbeat/modules.d/linux.yml.disabled | 2 +- 5 files changed, 94 insertions(+), 91 deletions(-) diff --git a/metricbeat/module/linux/pressure/_meta/data.json b/metricbeat/module/linux/pressure/_meta/data.json index 5f7abf63a68b..d491c80dca59 100644 --- a/metricbeat/module/linux/pressure/_meta/data.json +++ b/metricbeat/module/linux/pressure/_meta/data.json @@ -10,83 +10,23 @@ "name":"pressure", "rtt":44269 }, - "linux":{ - "pressure":{ - "example": "pressure" + "linux": { + "pressure": { + "io": { + "some": { + "10": 30.33, + "60": 9.48, + "300": 2.19, + "total": 175225414 + }, + "full": { + "10": 28.71, + "60": 8.87, + "300": 2.04, + "total": 164343466 + } + } } - }, + }, "type":"metricsets" } - - -{ - "@timestamp": "2021-08-12T06:16:57.057Z", - "@metadata": { - "beat": "metricbeat", - "type": "_doc", - "version": "8.0.0" - }, - "metricset": { - "name": "pressure", - "period": 10000 - }, - "service": { - "type": "linux" - }, - "ecs": { - "version": "1.10.0" - }, - "host": { - "ip": [ - "10.0.2.15", - "fe80::30:6ff:fee0:ff78" - ], - "mac": [ - "02:30:06:e0:ff:78" - ], - "name": "ubuntu-focal", - "hostname": "ubuntu-focal", - "architecture": "x86_64", - "os": { - "name": "Ubuntu", - "kernel": "5.4.0-80-generic", - "codename": "focal", - "type": "linux", - "platform": "ubuntu", - "version": "20.04.2 LTS (Focal Fossa)", - "family": "debian" - }, - "id": "a69be1f9fdda4e348cb3e682eb1085f1", - "containerized": false - }, - "agent": { - "ephemeral_id": "7afcb844-d7bb-46fa-82bd-738e69a16991", - "id": "715455b0-aacd-43b3-8a12-48c8fec62d2c", - "name": "ubuntu-focal", - "type": "metricbeat", - "version": "8.0.0" - }, - "linux": { - "pressure": { - "io": { - "some": { - "10": 0, - "60": 0, - "300": 0, - "total": 163773245 - }, - "full": { - "total": 154202053, - "10": 0, - "60": 0, - "300": 0 - } - } - } - }, - "event": { - "duration": 204672, - "dataset": "linux.pressure", - "module": "linux" - } -} diff --git a/metricbeat/module/linux/pressure/_meta/docs.asciidoc b/metricbeat/module/linux/pressure/_meta/docs.asciidoc index ac5b4dd8ae64..d35776c27807 100644 --- a/metricbeat/module/linux/pressure/_meta/docs.asciidoc +++ b/metricbeat/module/linux/pressure/_meta/docs.asciidoc @@ -1 +1 @@ -This is the pressure metricset of the module linux. +The Pressure module reports https://www.kernel.org/doc/Documentation/accounting/psi.txt[Pressure Stall Information (PSI)] collected for the `cpu`, `memory`, and `io` files/resources found in `/proc/pressure`. PSI metrics are included in Linux kernel versions from 4.20. Some distributions might have PSI support, but have disabled the feature via the `CONFIG_PSI_DEFAULT_DISABLED` setting, to enable PSI metrics pass `psi=1` on the kernel command line during boot. diff --git a/metricbeat/module/linux/pressure/_meta/fields.yml b/metricbeat/module/linux/pressure/_meta/fields.yml index 54c0c7137d2c..86f26fc33f6f 100644 --- a/metricbeat/module/linux/pressure/_meta/fields.yml +++ b/metricbeat/module/linux/pressure/_meta/fields.yml @@ -10,13 +10,81 @@ fields: - name: cpu.some.10 type: float - description: cpu pressure stall information + description: > + The average share of time in which at least some tasks were stalled on CPU over a ten second window. - name: cpu.some.60 type: float - description: cpu pressure stall information + description: > + The average share of time in which at least some tasks were stalled on CPU over a sixty second window. - name: cpu.some.300 type: float - description: cpu pressure stall information + description: > + The average share of time in which at least some tasks were stalled on CPU over a three hundred second window. - name: cpu.some.total type: float - description: cpu pressure stall information + description: > + The total absolute stall time (in us) in which at least some tasks were stalled on CPU. + - name: memory.some.10 + type: float + description: > + The average share of time in which at least some tasks were stalled on Memory over a ten second window. + - name: memory.some.60 + type: float + description: > + The average share of time in which at least some tasks were stalled on Memory over a 60 second window. + - name: memory.some.300 + type: float + description: > + The average share of time in which at least some tasks were stalled on Memory over a three hundred second window. + - name: memory.some.total + type: float + description: > + The total absolute stall time (in us) in which at least some tasks were stalled on memory. + - name: memory.full.10 + type: float + description: > + The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a ten second window. + - name: memory.full.60 + type: float + description: > + The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a sixty second window. + - name: memory.full.300 + type: float + description: > + The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a three hundred second window. + - name: memory.full.total + type: float + description: > + The total absolute stall time (in us) in which in which all non-idle tasks were stalled on memory. + - name: io.some.10 + type: float + description: > + The average share of time in which at least some tasks were stalled on io over a ten second window. + - name: io.some.60 + type: float + description: > + The average share of time in which at least some tasks were stalled on io over a 60 second window. + - name: io.some.300 + type: float + description: > + The average share of time in which at least some tasks were stalled on io over a three hundred second window. + - name: io.some.total + type: float + description: > + The total absolute stall time (in us) in which at least some tasks were stalled on io. + - name: io.full.10 + type: float + description: > + The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a ten second window. + - name: io.full.60 + type: float + description: > + The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a sixty second window. + - name: io.full.300 + type: float + description: > + The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a three hundred second window. + - name: io.full.total + type: float + description: > + The total absolute stall time (in us) in which in which all non-idle tasks were stalled on io. diff --git a/metricbeat/module/linux/pressure/pressure.go b/metricbeat/module/linux/pressure/pressure.go index f94dfd05de95..81cef26d5031 100644 --- a/metricbeat/module/linux/pressure/pressure.go +++ b/metricbeat/module/linux/pressure/pressure.go @@ -21,7 +21,7 @@ const ( // the MetricSet for each host defined in the module's configuration. After the // MetricSet has been created then Fetch will begin to be called periodically. func init() { - mb.Registry.MustAddMetricSet("linux", "pressure", New) + mb.Registry.MustAddMetricSet(moduleName, metricsetName, New) } // MetricSet holds any configuration or state information. It must implement @@ -36,17 +36,12 @@ type MetricSet struct { // New creates a new instance of the MetricSet. New is responsible for unpacking // any MetricSet specific configuration options if there are any. func New(base mb.BaseMetricSet) (mb.MetricSet, error) { - cfgwarn.Beta("The linux pressure metricset is beta.") + cfgwarn.Beta(fmt.Sprintf("The %s %s metricset is beta.", moduleName, metricsetName)) if runtime.GOOS != "linux" { return nil, fmt.Errorf("the %v/%v metricset is only supported on Linux", moduleName, metricsetName) } - config := struct{}{} - if err := base.Module().UnpackConfig(&config); err != nil { - return nil, err - } - fs, err := procfs.NewFS("/proc") if err != nil { return nil, errors.Wrap(err, "error getting procfs") @@ -82,7 +77,7 @@ func FetchLinuxPSIStats(m *MetricSet) ([]common.MapStr, error) { for _, resource := range resources { psiMetric, err := m.fs.PSIStatsForResource(resource) if err != nil { - return nil, errors.Wrap(err, "could not retrieve PSI stats for"+resource) + return nil, errors.Wrap(err, "check that /proc/pressure is available, and/or enabled") } event := common.MapStr{ diff --git a/metricbeat/modules.d/linux.yml.disabled b/metricbeat/modules.d/linux.yml.disabled index 2f2b9aeb9099..ffa61819901b 100644 --- a/metricbeat/modules.d/linux.yml.disabled +++ b/metricbeat/modules.d/linux.yml.disabled @@ -9,7 +9,7 @@ # - ksm # - conntrack # - iostat - - "pressure" + # - "pressure" enabled: true #hostfs: /hostfs From b63496b3ecceea9124872bedbddac36b0934d368 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Fri, 13 Aug 2021 13:37:51 +0930 Subject: [PATCH 03/13] Be consistent in default config --- metricbeat/module/linux/_meta/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metricbeat/module/linux/_meta/config.yml b/metricbeat/module/linux/_meta/config.yml index b0c9fb6a833f..cac485307965 100644 --- a/metricbeat/module/linux/_meta/config.yml +++ b/metricbeat/module/linux/_meta/config.yml @@ -6,7 +6,7 @@ # - ksm # - conntrack # - iostat - - "pressure" + # - pressure enabled: true #hostfs: /hostfs From f3f531a0f14c8eaf1482ad213177dc221b6bc77a Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Fri, 13 Aug 2021 13:39:45 +0930 Subject: [PATCH 04/13] Run integration tests --- .../module/linux/pressure/_meta/data.json | 45 +++++++++---------- metricbeat/modules.d/linux.yml.disabled | 2 +- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/metricbeat/module/linux/pressure/_meta/data.json b/metricbeat/module/linux/pressure/_meta/data.json index d491c80dca59..295bd1bdbcbc 100644 --- a/metricbeat/module/linux/pressure/_meta/data.json +++ b/metricbeat/module/linux/pressure/_meta/data.json @@ -1,32 +1,27 @@ { - "@timestamp":"2016-05-23T08:05:34.853Z", - "beat":{ - "hostname":"beathost", - "name":"beathost" - }, - "metricset":{ - "host":"localhost", - "module":"linux", - "name":"pressure", - "rtt":44269 + "@timestamp": "2017-10-12T08:05:34.853Z", + "event": { + "dataset": "linux.pressure", + "duration": 115000, + "module": "linux" }, "linux": { "pressure": { - "io": { - "some": { - "10": 30.33, - "60": 9.48, - "300": 2.19, - "total": 175225414 - }, - "full": { - "10": 28.71, - "60": 8.87, - "300": 2.04, - "total": 164343466 + "cpu": { + "some": { + "10": 1.63, + "300": 0.06, + "60": 0.29, + "total": 155911207 + } } - } } - }, - "type":"metricsets" + }, + "metricset": { + "name": "pressure", + "period": 10000 + }, + "service": { + "type": "linux" + } } diff --git a/metricbeat/modules.d/linux.yml.disabled b/metricbeat/modules.d/linux.yml.disabled index ffa61819901b..79fa81b4e0e1 100644 --- a/metricbeat/modules.d/linux.yml.disabled +++ b/metricbeat/modules.d/linux.yml.disabled @@ -9,7 +9,7 @@ # - ksm # - conntrack # - iostat - # - "pressure" + # - pressure enabled: true #hostfs: /hostfs From 4da242333093a2f2ae93cfb37d46f09c6b18adce Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Fri, 13 Aug 2021 16:19:33 +0930 Subject: [PATCH 05/13] Make update --- metricbeat/docs/fields.asciidoc | 204 +++++++++++++++++- metricbeat/docs/modules/linux.asciidoc | 2 +- metricbeat/metricbeat.reference.yml | 1 + metricbeat/module/linux/fields.go | 2 +- metricbeat/module/linux/pressure/pressure.go | 22 +- .../module/linux/pressure/pressure_test.go | 20 +- x-pack/metricbeat/metricbeat.reference.yml | 1 + 7 files changed, 243 insertions(+), 9 deletions(-) diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index c1cea76cb571..6f8193c315c2 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -39022,17 +39022,213 @@ type: object [float] === pressure -pressure +Linux pressure stall information metrics for cpu, memory, and io -*`linux.pressure.example`*:: +[float] +=== pressure + +Linux pressure stall information + + +*`linux.pressure.pressure.cpu.some.10`*:: + -- -Example field +The average share of time in which at least some tasks were stalled on CPU over a ten second window. -type: keyword +type: float + +-- + +*`linux.pressure.pressure.cpu.some.60`*:: ++ +-- +The average share of time in which at least some tasks were stalled on CPU over a sixty second window. + + +type: float + +-- + +*`linux.pressure.pressure.cpu.some.300`*:: ++ +-- +The average share of time in which at least some tasks were stalled on CPU over a three hundred second window. + + +type: float + +-- + +*`linux.pressure.pressure.cpu.some.total`*:: ++ +-- +The total absolute stall time (in us) in which at least some tasks were stalled on CPU. + + +type: float + +-- + +*`linux.pressure.pressure.memory.some.10`*:: ++ +-- +The average share of time in which at least some tasks were stalled on Memory over a ten second window. + + +type: float + +-- + +*`linux.pressure.pressure.memory.some.60`*:: ++ +-- +The average share of time in which at least some tasks were stalled on Memory over a 60 second window. + + +type: float + +-- + +*`linux.pressure.pressure.memory.some.300`*:: ++ +-- +The average share of time in which at least some tasks were stalled on Memory over a three hundred second window. + + +type: float + +-- + +*`linux.pressure.pressure.memory.some.total`*:: ++ +-- +The total absolute stall time (in us) in which at least some tasks were stalled on memory. + + +type: float + +-- + +*`linux.pressure.pressure.memory.full.10`*:: ++ +-- +The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a ten second window. + + +type: float + +-- + +*`linux.pressure.pressure.memory.full.60`*:: ++ +-- +The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a sixty second window. + + +type: float + +-- + +*`linux.pressure.pressure.memory.full.300`*:: ++ +-- +The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a three hundred second window. + + +type: float + +-- + +*`linux.pressure.pressure.memory.full.total`*:: ++ +-- +The total absolute stall time (in us) in which in which all non-idle tasks were stalled on memory. + + +type: float + +-- + +*`linux.pressure.pressure.io.some.10`*:: ++ +-- +The average share of time in which at least some tasks were stalled on io over a ten second window. + + +type: float + +-- + +*`linux.pressure.pressure.io.some.60`*:: ++ +-- +The average share of time in which at least some tasks were stalled on io over a 60 second window. + + +type: float + +-- + +*`linux.pressure.pressure.io.some.300`*:: ++ +-- +The average share of time in which at least some tasks were stalled on io over a three hundred second window. + + +type: float + +-- + +*`linux.pressure.pressure.io.some.total`*:: ++ +-- +The total absolute stall time (in us) in which at least some tasks were stalled on io. + + +type: float + +-- + +*`linux.pressure.pressure.io.full.10`*:: ++ +-- +The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a ten second window. + + +type: float + +-- + +*`linux.pressure.pressure.io.full.60`*:: ++ +-- +The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a sixty second window. + + +type: float + +-- + +*`linux.pressure.pressure.io.full.300`*:: ++ +-- +The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a three hundred second window. + + +type: float + +-- + +*`linux.pressure.pressure.io.full.total`*:: ++ +-- +The total absolute stall time (in us) in which in which all non-idle tasks were stalled on io. + + +type: float -- diff --git a/metricbeat/docs/modules/linux.asciidoc b/metricbeat/docs/modules/linux.asciidoc index ffbd30fe9417..d7bb7f66315f 100644 --- a/metricbeat/docs/modules/linux.asciidoc +++ b/metricbeat/docs/modules/linux.asciidoc @@ -26,7 +26,7 @@ metricbeat.modules: # - ksm # - conntrack # - iostat - - "pressure" + # - pressure enabled: true #hostfs: /hostfs diff --git a/metricbeat/metricbeat.reference.yml b/metricbeat/metricbeat.reference.yml index c3012225a8e0..d000fd9b3bca 100644 --- a/metricbeat/metricbeat.reference.yml +++ b/metricbeat/metricbeat.reference.yml @@ -594,6 +594,7 @@ metricbeat.modules: # - ksm # - conntrack # - iostat + # - pressure enabled: true #hostfs: /hostfs diff --git a/metricbeat/module/linux/fields.go b/metricbeat/module/linux/fields.go index 4781625d383c..fdaaa32dca10 100644 --- a/metricbeat/module/linux/fields.go +++ b/metricbeat/module/linux/fields.go @@ -32,5 +32,5 @@ func init() { // AssetLinux returns asset data. // This is the base64 encoded zlib format compressed contents of module/linux. func AssetLinux() string { - return "eJzEmt9v20YSx9/9VwwMHJAEF8XO7+jhAN85OAStW6NJXlq0xGg5lLZa7jL7Q7Ly1xe7K1qURIq0JTJ6KWpSM5/9zuzM7CrPYU6rMQgu3d0ZgOVW0BjOw/+fnwFoEoSGxjAhi2cAKRmmeWG5kmP4zxkAxO9CrlIn6Awg4yRSMw6PnoPEnDbm/ceuChrDVCtXrP9SY3Nj16yMpRxyspozs35Y9VH1w5SUViOb3z+p8+c/u+sqPw0s/lNnfBekCmNcnqNebT1rwmlx7T9rc6AykFlyDwPGouXGcmb+Hd6hFJBpZQz87/YrMKXJ7Niqg66Cp1rtsm3IhZLTmoct8P5TIJuTNcF8QSmkjsCqjayQIRfcaWoEI9RilfSEt+EgaTWnDahVkOOcQCuVQ6Y0SFqCknu6VkCjhR4oSzYuwc6oAm1xIpqVy5STaQ84xjFGxmROiBUYQs1mlDYuv6ThU6lqwny6FDNEElBownQVNCJmYyBxJ86727MCKQ1pm/ikpD6k+8XlE9J+O5cxXc5IEwhu7Np5+Z/IAAdQFyj4kZD75vcUtTO0wFBKZWFCEFSs0ea+AIZ8SDQZi9r2IGHIeRBKzV3h5eNsBjMMcZ4QrP1uKk18XZPh3yvJeS+i8pW0j8axZ/lQ1/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Zm2JSj7bt3oTHlTw9w++/ghf/cHtrdf/UHgrAKUCWtb/W1Xd73KVI+ifAgZQI7E040siZu7/qjoyFYZYkYtuy6GnpNUPl0qlBKtCeiM8gab5p6c7d9uQf2p9iFPYOnJUKoOItsVHSQH6qaDu6e1dIy5m2dgbey6OCkrPHo8f2y+UEWhIswPx+bKRrjRcnz8lcUMHUWpLKNSdNPkHG6EG7gNtmlRy1QU5XnvG/aM0yJE7bpuq83+hkl+xjNx7vMVOlG5vqUzmWqhjg5NKx96MAwdYytkp0vtAP18MYjsSRenb8ttKJvgwVvIC7mu2HY2GJGTlegNNvLl66O8vjpY2uQm5h7cAf2Tx/j2edx+8jVhVVHu73b7cHbeC052JMwUGhEoJmTc+NL5d1/7779/PEvPydffvnXz4fR7kdHu++L9m50tHd90d6Pjva+L9p3o6N91xft+9HRvu+L9mF0tA990X4YHe2Hvmg/jo72Y1+0n0ZH+6n3ljt+O7hv6wcVlFQMzeTbxo6vpv/DvcNDD5J/kmU1c3IlITT82hTgu6o3sDVp7A9GGo3Z/pHlha9UKwv+3CtEwPSzn0cuf8UbpjdauNflSf01EMmA9x2oGiS0y9hD7oI8ckyihZsYlePk/q51XGq7PekR863ntRnRWD2O8AeN+MCTWPCRsuAxwBIzL597BmnIQMnwqNTP+0DAoqx+D7Xkkqll+8C/1vbhSrQZ/mRXR6t7f3cl8mzm96HMSaaRHS3z8BXRmULD4kCmRglnq6pa/7DAmVdHi25XVF7vvfyqKy+Zji+8usIXXXvbCj/cnSLwZZffTgxPqcC62Gsqwq4nCeX7qRPi+epwo0gIkEq+4UwcFgSG505YIlE5I84ozyD82crzYsKPapp16c9XuJcL+hn1HHzwUur5eI+06+PqCnorVycUbqXsRffUjbL+/bQS9rJ7aS1mp9RdJfKl1Fw/yQf1XE/v5Or8vlkJvoqe2Sr4qH5ZSb6OXtke5BPr9Wp7pK/b/wcAAP//w/iQiw==" } diff --git a/metricbeat/module/linux/pressure/pressure.go b/metricbeat/module/linux/pressure/pressure.go index 81cef26d5031..8bd0672a1547 100644 --- a/metricbeat/module/linux/pressure/pressure.go +++ b/metricbeat/module/linux/pressure/pressure.go @@ -1,14 +1,32 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package pressure import ( "fmt" "runtime" + "github.com/pkg/errors" + "github.com/prometheus/procfs" + "github.com/elastic/beats/v7/libbeat/common" "github.com/elastic/beats/v7/libbeat/common/cfgwarn" "github.com/elastic/beats/v7/metricbeat/mb" - "github.com/pkg/errors" - "github.com/prometheus/procfs" ) const ( diff --git a/metricbeat/module/linux/pressure/pressure_test.go b/metricbeat/module/linux/pressure/pressure_test.go index 42b36a6dac7c..833bab937369 100644 --- a/metricbeat/module/linux/pressure/pressure_test.go +++ b/metricbeat/module/linux/pressure/pressure_test.go @@ -1,3 +1,22 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// +build linux + package pressure import ( @@ -16,7 +35,6 @@ func TestFetch(t *testing.T) { if !assert.NotEmpty(t, events) { t.FailNow() } - t.Logf("%s/%s event: %+v", f.Module().Name(), f.Name(), events[0].BeatEvent("linux", "pressure").Fields.StringToPrint()) } diff --git a/x-pack/metricbeat/metricbeat.reference.yml b/x-pack/metricbeat/metricbeat.reference.yml index 65f84166d726..9ab38f1cfc2b 100644 --- a/x-pack/metricbeat/metricbeat.reference.yml +++ b/x-pack/metricbeat/metricbeat.reference.yml @@ -966,6 +966,7 @@ metricbeat.modules: # - ksm # - conntrack # - iostat + # - pressure enabled: true #hostfs: /hostfs From 4d572d664e87e6ef5259dee6b34ec00b705057e5 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Fri, 13 Aug 2021 16:24:16 +0930 Subject: [PATCH 06/13] make update v3 --- metricbeat/docs/modules/linux/memory.asciidoc | 1 - 1 file changed, 1 deletion(-) diff --git a/metricbeat/docs/modules/linux/memory.asciidoc b/metricbeat/docs/modules/linux/memory.asciidoc index 9ea3d482e573..67459f359094 100644 --- a/metricbeat/docs/modules/linux/memory.asciidoc +++ b/metricbeat/docs/modules/linux/memory.asciidoc @@ -9,7 +9,6 @@ beta[] include::../../../module/linux/memory/_meta/docs.asciidoc[] -This is a default metricset. If the host module is unconfigured, this metricset is enabled by default. ==== Fields From a470b1ebea101f3f914fffdb06b86af57b728938 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Mon, 16 Aug 2021 17:59:39 +0930 Subject: [PATCH 07/13] Address comments --- metricbeat/docs/fields.asciidoc | 84 +++++++++++++------ metricbeat/module/linux/fields.go | 2 +- .../module/linux/pressure/_meta/fields.yml | 69 +++++++++------ .../pressure/_meta/testdata/proc/pressure/cpu | 1 + .../pressure/_meta/testdata/proc/pressure/io | 2 + .../_meta/testdata/proc/pressure/memory | 2 + metricbeat/module/linux/pressure/pressure.go | 51 +++++++---- .../module/linux/pressure/pressure_test.go | 45 ++++++++++ 8 files changed, 186 insertions(+), 70 deletions(-) create mode 100644 metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/cpu create mode 100644 metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/io create mode 100644 metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/memory diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 6f8193c315c2..425be82f15e3 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -39032,7 +39032,7 @@ Linux pressure stall information metrics for cpu, memory, and io Linux pressure stall information -*`linux.pressure.pressure.cpu.some.10`*:: +*`linux.pressure.pressure.cpu.some.10.pct`*:: + -- The average share of time in which at least some tasks were stalled on CPU over a ten second window. @@ -39040,9 +39040,11 @@ The average share of time in which at least some tasks were stalled on CPU over type: float +format: percent + -- -*`linux.pressure.pressure.cpu.some.60`*:: +*`linux.pressure.pressure.cpu.some.60.pct`*:: + -- The average share of time in which at least some tasks were stalled on CPU over a sixty second window. @@ -39050,9 +39052,11 @@ The average share of time in which at least some tasks were stalled on CPU over type: float +format: percent + -- -*`linux.pressure.pressure.cpu.some.300`*:: +*`linux.pressure.pressure.cpu.some.300.pct`*:: + -- The average share of time in which at least some tasks were stalled on CPU over a three hundred second window. @@ -39060,19 +39064,21 @@ The average share of time in which at least some tasks were stalled on CPU over type: float +format: percent + -- -*`linux.pressure.pressure.cpu.some.total`*:: +*`linux.pressure.pressure.cpu.some.total.time.us`*:: + -- The total absolute stall time (in us) in which at least some tasks were stalled on CPU. -type: float +type: long -- -*`linux.pressure.pressure.memory.some.10`*:: +*`linux.pressure.pressure.memory.some.10.pct`*:: + -- The average share of time in which at least some tasks were stalled on Memory over a ten second window. @@ -39080,19 +39086,23 @@ The average share of time in which at least some tasks were stalled on Memory ov type: float +format: percent + -- -*`linux.pressure.pressure.memory.some.60`*:: +*`linux.pressure.pressure.memory.some.60.pct`*:: + -- -The average share of time in which at least some tasks were stalled on Memory over a 60 second window. +The average share of time in which at least some tasks were stalled on Memory over a 60.pct second window. type: float +format: percent + -- -*`linux.pressure.pressure.memory.some.300`*:: +*`linux.pressure.pressure.memory.some.300.pct`*:: + -- The average share of time in which at least some tasks were stalled on Memory over a three hundred second window. @@ -39100,19 +39110,21 @@ The average share of time in which at least some tasks were stalled on Memory ov type: float +format: percent + -- -*`linux.pressure.pressure.memory.some.total`*:: +*`linux.pressure.pressure.memory.some.total.time.us`*:: + -- The total absolute stall time (in us) in which at least some tasks were stalled on memory. -type: float +type: long -- -*`linux.pressure.pressure.memory.full.10`*:: +*`linux.pressure.pressure.memory.full.10.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a ten second window. @@ -39120,9 +39132,11 @@ The average share of time in which in which all non-idle tasks were stalled on m type: float +format: percent + -- -*`linux.pressure.pressure.memory.full.60`*:: +*`linux.pressure.pressure.memory.full.60.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a sixty second window. @@ -39130,9 +39144,11 @@ The average share of time in which in which all non-idle tasks were stalled on m type: float +format: percent + -- -*`linux.pressure.pressure.memory.full.300`*:: +*`linux.pressure.pressure.memory.full.300.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a three hundred second window. @@ -39140,19 +39156,21 @@ The average share of time in which in which all non-idle tasks were stalled on m type: float +format: percent + -- -*`linux.pressure.pressure.memory.full.total`*:: +*`linux.pressure.pressure.memory.full.total.time.us`*:: + -- The total absolute stall time (in us) in which in which all non-idle tasks were stalled on memory. -type: float +type: long -- -*`linux.pressure.pressure.io.some.10`*:: +*`linux.pressure.pressure.io.some.10.pct`*:: + -- The average share of time in which at least some tasks were stalled on io over a ten second window. @@ -39160,19 +39178,23 @@ The average share of time in which at least some tasks were stalled on io over a type: float +format: percent + -- -*`linux.pressure.pressure.io.some.60`*:: +*`linux.pressure.pressure.io.some.60.pct`*:: + -- -The average share of time in which at least some tasks were stalled on io over a 60 second window. +The average share of time in which at least some tasks were stalled on io over a 60.pct second window. type: float +format: percent + -- -*`linux.pressure.pressure.io.some.300`*:: +*`linux.pressure.pressure.io.some.300.pct`*:: + -- The average share of time in which at least some tasks were stalled on io over a three hundred second window. @@ -39180,19 +39202,21 @@ The average share of time in which at least some tasks were stalled on io over a type: float +format: percent + -- -*`linux.pressure.pressure.io.some.total`*:: +*`linux.pressure.pressure.io.some.total.time.us`*:: + -- The total absolute stall time (in us) in which at least some tasks were stalled on io. -type: float +type: long -- -*`linux.pressure.pressure.io.full.10`*:: +*`linux.pressure.pressure.io.full.10.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a ten second window. @@ -39200,9 +39224,11 @@ The average share of time in which in which all non-idle tasks were stalled on i type: float +format: percent + -- -*`linux.pressure.pressure.io.full.60`*:: +*`linux.pressure.pressure.io.full.60.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a sixty second window. @@ -39210,9 +39236,11 @@ The average share of time in which in which all non-idle tasks were stalled on i type: float +format: percent + -- -*`linux.pressure.pressure.io.full.300`*:: +*`linux.pressure.pressure.io.full.300.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a three hundred second window. @@ -39220,15 +39248,17 @@ The average share of time in which in which all non-idle tasks were stalled on i type: float +format: percent + -- -*`linux.pressure.pressure.io.full.total`*:: +*`linux.pressure.pressure.io.full.total.time.us`*:: + -- The total absolute stall time (in us) in which in which all non-idle tasks were stalled on io. -type: float +type: long -- diff --git a/metricbeat/module/linux/fields.go b/metricbeat/module/linux/fields.go index fdaaa32dca10..0118a3f6ced3 100644 --- a/metricbeat/module/linux/fields.go +++ b/metricbeat/module/linux/fields.go @@ -32,5 +32,5 @@ func init() { // AssetLinux returns asset data. // This is the base64 encoded zlib format compressed contents of module/linux. func AssetLinux() string { - return "eJzUmluP27gVx9/nUxwMUGCzSJyZZDe7Ow8F0s6iWLRpg2b3pUUr0OSRxZoiFV7s8X76gqRky7ZkyRdpxn4JMrZ5fv9z4Tmk/AbmuHoAwaV7ugGw3Ap8gNvw/9sbAI0CicEHmKIlNwAMDdW8sFz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3RqOrh7npaWNm9rBt6KooOdssaj2/fLxgdZEC5C/3xspGiMFyVflr+igKmzIJVtDJp+DhmnC+EGLpNd/qgFaqrynPcNe4YpccI2Xff1Rj/jyD5G8/EuM1W6kbnepXOZqiEmh4a1Dw0MU8fYKtn5QjtQDzUeiSXx6vx1oRV9HSx4A3ExXw1DYosROV2B0mwvXroqyuOH962b3MTcgzuwf3gfZ5/H7ZGrC6uOdnu3W4O38VpisCdhoNCIQDMn58YflTf/vfv24/u//Jx8+uVfPx9Gux8d7b4v2pvR0d70RXs7OtrbvmjfjY72XV+070dH+74v2rvR0d71RfthdLQf+qL9ODraj33Rfhod7afeKXf8cnDfVg8qKKkYmsm3jRVfTf+He8NDD5J/kmXVc3IlIRT8Whfgq6o3sNVp7DdGGo3Z/pHlha9UKwt+7hUiYPrezyOXv+IN3Rst3MtyUn8JRDLgfRuqBhfa3dhD7oI8sk2ihZsYlePk/u7gSHihG5TmyNh6qpsRjdVDCz+OxMeixILfTwseFiwx8/LpaBAAGSgZHqj6qQAIWJTVr6aWXDK1bB8L1gq8e1YKGP5kV0dr8PbuWYlgM5/5MieZRna0GOFSauIBJscPuz39DTaATI0SzlbHef2LBmdeHO17u2PlveJzOe7lHdjxJ76uwzM49Ns6RIdOkeI5nP2dmDjl+Ncl+QozQNfzk/L91Alx7Ulg47cQIJV8xZk47DYYnjthiUTljDgjNwR5rjw3XEyeo1qFukDXnjEuF0BnJJKg1JUlkuOFaXeTq2fTUXB1Qsao/L/ybHGc/8d1EZUE154PjoyBUw59JcWVHfh+nh9067l1DFyd3y1Uslz52b+ILEd1CZUw154RLhMwJyaKr70z8Anj/wEAAP//3RYv4g==" } diff --git a/metricbeat/module/linux/pressure/_meta/fields.yml b/metricbeat/module/linux/pressure/_meta/fields.yml index 86f26fc33f6f..c9840de7f341 100644 --- a/metricbeat/module/linux/pressure/_meta/fields.yml +++ b/metricbeat/module/linux/pressure/_meta/fields.yml @@ -8,83 +8,98 @@ type: group description: Linux pressure stall information fields: - - name: cpu.some.10 + - name: cpu.some.10.pct type: float + format: percent description: > The average share of time in which at least some tasks were stalled on CPU over a ten second window. - - name: cpu.some.60 + - name: cpu.some.60.pct type: float + format: percent description: > The average share of time in which at least some tasks were stalled on CPU over a sixty second window. - - name: cpu.some.300 + - name: cpu.some.300.pct type: float + format: percent description: > The average share of time in which at least some tasks were stalled on CPU over a three hundred second window. - - name: cpu.some.total - type: float + - name: cpu.some.total.time.us + type: long description: > The total absolute stall time (in us) in which at least some tasks were stalled on CPU. - - name: memory.some.10 + - name: memory.some.10.pct type: float + format: percent description: > The average share of time in which at least some tasks were stalled on Memory over a ten second window. - - name: memory.some.60 + - name: memory.some.60.pct type: float + format: percent description: > - The average share of time in which at least some tasks were stalled on Memory over a 60 second window. - - name: memory.some.300 + The average share of time in which at least some tasks were stalled on Memory over a 60.pct second window. + - name: memory.some.300.pct type: float + format: percent description: > The average share of time in which at least some tasks were stalled on Memory over a three hundred second window. - - name: memory.some.total - type: float + - name: memory.some.total.time.us + type: long description: > The total absolute stall time (in us) in which at least some tasks were stalled on memory. - - name: memory.full.10 + - name: memory.full.10.pct type: float + format: percent description: > The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a ten second window. - - name: memory.full.60 + - name: memory.full.60.pct type: float + format: percent description: > The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a sixty second window. - - name: memory.full.300 + - name: memory.full.300.pct type: float + format: percent description: > The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a three hundred second window. - - name: memory.full.total - type: float + - name: memory.full.total.time.us + type: long description: > The total absolute stall time (in us) in which in which all non-idle tasks were stalled on memory. - - name: io.some.10 + - name: io.some.10.pct type: float + format: percent description: > The average share of time in which at least some tasks were stalled on io over a ten second window. - - name: io.some.60 + - name: io.some.60.pct type: float + format: percent description: > - The average share of time in which at least some tasks were stalled on io over a 60 second window. - - name: io.some.300 + The average share of time in which at least some tasks were stalled on io over a 60.pct second window. + - name: io.some.300.pct type: float + format: percent description: > The average share of time in which at least some tasks were stalled on io over a three hundred second window. - - name: io.some.total - type: float + - name: io.some.total.time.us + type: long description: > The total absolute stall time (in us) in which at least some tasks were stalled on io. - - name: io.full.10 + - name: io.full.10.pct type: float + format: percent description: > The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a ten second window. - - name: io.full.60 + - name: io.full.60.pct type: float + format: percent description: > The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a sixty second window. - - name: io.full.300 + - name: io.full.300.pct type: float + format: percent description: > The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a three hundred second window. - - name: io.full.total - type: float + - name: io.full.total.time.us + type: long description: > The total absolute stall time (in us) in which in which all non-idle tasks were stalled on io. diff --git a/metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/cpu b/metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/cpu new file mode 100644 index 000000000000..49932c3025a7 --- /dev/null +++ b/metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/cpu @@ -0,0 +1 @@ +some avg10=5.86 avg60=1.10 avg300=0.23 total=9895236 diff --git a/metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/io b/metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/io new file mode 100644 index 000000000000..16963d05439f --- /dev/null +++ b/metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/io @@ -0,0 +1,2 @@ +some avg10=5.86 avg60=1.10 avg300=0.23 total=9895236 +full avg10=6.86 avg60=2.10 avg300=1.23 total=10895236 diff --git a/metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/memory b/metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/memory new file mode 100644 index 000000000000..16963d05439f --- /dev/null +++ b/metricbeat/module/linux/pressure/_meta/testdata/proc/pressure/memory @@ -0,0 +1,2 @@ +some avg10=5.86 avg60=1.10 avg300=0.23 total=9895236 +full avg10=6.86 avg60=2.10 avg300=1.23 total=10895236 diff --git a/metricbeat/module/linux/pressure/pressure.go b/metricbeat/module/linux/pressure/pressure.go index 8bd0672a1547..fbd7ddb45152 100644 --- a/metricbeat/module/linux/pressure/pressure.go +++ b/metricbeat/module/linux/pressure/pressure.go @@ -19,6 +19,7 @@ package pressure import ( "fmt" + "path/filepath" "runtime" "github.com/pkg/errors" @@ -27,6 +28,7 @@ import ( "github.com/elastic/beats/v7/libbeat/common" "github.com/elastic/beats/v7/libbeat/common/cfgwarn" "github.com/elastic/beats/v7/metricbeat/mb" + "github.com/elastic/beats/v7/metricbeat/module/linux" ) const ( @@ -48,7 +50,8 @@ func init() { // interface methods except for Fetch. type MetricSet struct { mb.BaseMetricSet - fs procfs.FS + fs string + procfs procfs.FS } // New creates a new instance of the MetricSet. New is responsible for unpacking @@ -60,14 +63,21 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { return nil, fmt.Errorf("the %v/%v metricset is only supported on Linux", moduleName, metricsetName) } - fs, err := procfs.NewFS("/proc") + linuxModule, ok := base.Module().(*linux.Module) + if !ok { + return nil, errors.New("unexpected module type") + } + + path := filepath.Join(linuxModule.HostFS, "proc") + procfs, err := procfs.NewFS(path) if err != nil { - return nil, errors.Wrap(err, "error getting procfs") + return nil, errors.Wrapf(err, "error creating new Host FS at %s", path) } return &MetricSet{ BaseMetricSet: base, - fs: fs, + fs: linuxModule.HostFS, + procfs: procfs, }, nil } @@ -75,7 +85,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { // format. It publishes the event which is then forwarded to the output. In case // of an error set the Error field of mb.Event or simply call report.Error(). func (m *MetricSet) Fetch(report mb.ReporterV2) error { - events, err := FetchLinuxPSIStats(m) + events, err := fetchLinuxPSIStats(m) if err != nil { return errors.Wrap(err, "error fetching PSI stats") } @@ -88,12 +98,12 @@ func (m *MetricSet) Fetch(report mb.ReporterV2) error { return nil } -func FetchLinuxPSIStats(m *MetricSet) ([]common.MapStr, error) { +func fetchLinuxPSIStats(m *MetricSet) ([]common.MapStr, error) { resources := []string{"cpu", "memory", "io"} events := []common.MapStr{} for _, resource := range resources { - psiMetric, err := m.fs.PSIStatsForResource(resource) + psiMetric, err := m.procfs.PSIStatsForResource(resource) if err != nil { return nil, errors.Wrap(err, "check that /proc/pressure is available, and/or enabled") } @@ -101,19 +111,30 @@ func FetchLinuxPSIStats(m *MetricSet) ([]common.MapStr, error) { event := common.MapStr{ resource: common.MapStr{ "some": common.MapStr{ - "10": psiMetric.Some.Avg10, - "60": psiMetric.Some.Avg60, - "300": psiMetric.Some.Avg300, - "total": psiMetric.Some.Total, + "10": common.MapStr{ + "pct": psiMetric.Some.Avg10, + }, + "60": common.MapStr{ + "pct": psiMetric.Some.Avg60, + }, + "300": common.MapStr{ + "pct": psiMetric.Some.Avg300, + }, + "total": common.MapStr{ + "time": common.MapStr{ + "us": psiMetric.Some.Total, + }, + }, }, }, } + // /proc/pressure/cpu does not contain 'full' metrics if resource != "cpu" { - event.Put(resource+".full.10", psiMetric.Full.Avg10) - event.Put(resource+".full.60", psiMetric.Full.Avg60) - event.Put(resource+".full.300", psiMetric.Full.Avg300) - event.Put(resource+".full.total", psiMetric.Full.Total) + event.Put(resource+".full.10.pct", psiMetric.Full.Avg10) + event.Put(resource+".full.60.pct", psiMetric.Full.Avg60) + event.Put(resource+".full.300.pct", psiMetric.Full.Avg300) + event.Put(resource+".full.total.time.us", psiMetric.Full.Total) } events = append(events, event) diff --git a/metricbeat/module/linux/pressure/pressure_test.go b/metricbeat/module/linux/pressure/pressure_test.go index 833bab937369..a527e1c81119 100644 --- a/metricbeat/module/linux/pressure/pressure_test.go +++ b/metricbeat/module/linux/pressure/pressure_test.go @@ -20,10 +20,13 @@ package pressure import ( + "fmt" "testing" "github.com/stretchr/testify/assert" + "github.com/elastic/beats/v7/libbeat/common" + mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing" ) @@ -37,6 +40,47 @@ func TestFetch(t *testing.T) { } t.Logf("%s/%s event: %+v", f.Module().Name(), f.Name(), events[0].BeatEvent("linux", "pressure").Fields.StringToPrint()) + + resources := []string{"cpu", "memory", "io"} + for i, _ := range events { + resource := resources[i] + fmt.Println("######") + fmt.Println(resources[i]) + fmt.Println(events[i].BeatEvent("linux", "pressure").Fields["linux"].(common.MapStr)["pressure"]) + fmt.Println("######") + + testEvent := common.MapStr{ + resource: common.MapStr{ + "some": common.MapStr{ + "10": common.MapStr{ + "pct": 5.86, + }, + "60": common.MapStr{ + "pct": 1.10, + }, + "300": common.MapStr{ + "pct": 0.23, + }, + "total": common.MapStr{ + "time": common.MapStr{ + "us": uint64(9895236), + }, + }, + }, + }, + } + // /proc/pressure/cpu does not contain 'full' metrics + if resource != "cpu" { + testEvent.Put(resource+".full.10.pct", 6.86) + testEvent.Put(resource+".full.60.pct", 2.10) + testEvent.Put(resource+".full.300.pct", 1.23) + testEvent.Put(resource+".full.total.time.us", uint64(10895236)) + } + + rawEvent := events[i].BeatEvent("linux", "pressure").Fields["linux"].(common.MapStr)["pressure"] + assert.Equal(t, testEvent, rawEvent) + + } } func TestData(t *testing.T) { @@ -51,5 +95,6 @@ func getConfig() map[string]interface{} { return map[string]interface{}{ "module": "linux", "metricsets": []string{"pressure"}, + "hostfs": "./_meta/testdata", } } From 2c411268d1e1a0705c111952d72571f63f4b705e Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Mon, 16 Aug 2021 18:02:00 +0930 Subject: [PATCH 08/13] Format tests --- metricbeat/module/linux/pressure/pressure_test.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/metricbeat/module/linux/pressure/pressure_test.go b/metricbeat/module/linux/pressure/pressure_test.go index a527e1c81119..ac0b824bd6cc 100644 --- a/metricbeat/module/linux/pressure/pressure_test.go +++ b/metricbeat/module/linux/pressure/pressure_test.go @@ -42,12 +42,9 @@ func TestFetch(t *testing.T) { events[0].BeatEvent("linux", "pressure").Fields.StringToPrint()) resources := []string{"cpu", "memory", "io"} + for i, _ := range events { resource := resources[i] - fmt.Println("######") - fmt.Println(resources[i]) - fmt.Println(events[i].BeatEvent("linux", "pressure").Fields["linux"].(common.MapStr)["pressure"]) - fmt.Println("######") testEvent := common.MapStr{ resource: common.MapStr{ @@ -79,7 +76,6 @@ func TestFetch(t *testing.T) { rawEvent := events[i].BeatEvent("linux", "pressure").Fields["linux"].(common.MapStr)["pressure"] assert.Equal(t, testEvent, rawEvent) - } } From d46e1ea10cfe1ea0866bb1c7ceda3c6ac52863b4 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Mon, 16 Aug 2021 18:13:02 +0930 Subject: [PATCH 09/13] Remove unused imports from tests --- metricbeat/module/linux/pressure/pressure_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/metricbeat/module/linux/pressure/pressure_test.go b/metricbeat/module/linux/pressure/pressure_test.go index ac0b824bd6cc..0454ba340ea4 100644 --- a/metricbeat/module/linux/pressure/pressure_test.go +++ b/metricbeat/module/linux/pressure/pressure_test.go @@ -20,7 +20,6 @@ package pressure import ( - "fmt" "testing" "github.com/stretchr/testify/assert" From ac5f0ee95cdebfdfd20883505b6c98bf8b9e3dd3 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Wed, 18 Aug 2021 11:17:27 +0930 Subject: [PATCH 10/13] Mage format --- metricbeat/docs/modules/linux/memory.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/metricbeat/docs/modules/linux/memory.asciidoc b/metricbeat/docs/modules/linux/memory.asciidoc index 67459f359094..9ea3d482e573 100644 --- a/metricbeat/docs/modules/linux/memory.asciidoc +++ b/metricbeat/docs/modules/linux/memory.asciidoc @@ -9,6 +9,7 @@ beta[] include::../../../module/linux/memory/_meta/docs.asciidoc[] +This is a default metricset. If the host module is unconfigured, this metricset is enabled by default. ==== Fields From b496aebdebab333a078348682d65665750cbce09 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Wed, 18 Aug 2021 11:25:35 +0930 Subject: [PATCH 11/13] Update changelog --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 3a7b369a1654..d10301597e2b 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -102,6 +102,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Added Airflow lightweight module {pull}26220[26220] - Add state_job metricset to Kubernetes module{pull}26479[26479] - Bump AWS SDK version to v0.24.0 for WebIdentity authentication flow {issue}19393[19393] {pull}27126[27126] +- Add Linux pressure metricset {pull}27355[27355] *Packetbeat* From 44511829487e372aa7333b2c0985de4c6d346449 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Thu, 19 Aug 2021 09:20:23 +0930 Subject: [PATCH 12/13] simplify loop --- metricbeat/module/linux/pressure/pressure_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metricbeat/module/linux/pressure/pressure_test.go b/metricbeat/module/linux/pressure/pressure_test.go index 0454ba340ea4..083efa9d0c0e 100644 --- a/metricbeat/module/linux/pressure/pressure_test.go +++ b/metricbeat/module/linux/pressure/pressure_test.go @@ -42,7 +42,7 @@ func TestFetch(t *testing.T) { resources := []string{"cpu", "memory", "io"} - for i, _ := range events { + for i := range events { resource := resources[i] testEvent := common.MapStr{ From c4cbb2ae6d322b00a57346b186127580677f1ee5 Mon Sep 17 00:00:00 2001 From: Brad Deam Date: Thu, 19 Aug 2021 12:45:25 +0930 Subject: [PATCH 13/13] Fix fields/mapping --- metricbeat/docs/fields.asciidoc | 61 +++--- metricbeat/module/linux/fields.go | 2 +- .../module/linux/pressure/_meta/fields.yml | 197 +++++++++--------- 3 files changed, 124 insertions(+), 136 deletions(-) diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index cbc4f378dd1c..21a7877be11c 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -43515,14 +43515,7 @@ type: object Linux pressure stall information metrics for cpu, memory, and io - -[float] -=== pressure - -Linux pressure stall information - - -*`linux.pressure.pressure.cpu.some.10.pct`*:: +*`linux.pressure.cpu.some.10.pct`*:: + -- The average share of time in which at least some tasks were stalled on CPU over a ten second window. @@ -43534,7 +43527,7 @@ format: percent -- -*`linux.pressure.pressure.cpu.some.60.pct`*:: +*`linux.pressure.cpu.some.60.pct`*:: + -- The average share of time in which at least some tasks were stalled on CPU over a sixty second window. @@ -43546,7 +43539,7 @@ format: percent -- -*`linux.pressure.pressure.cpu.some.300.pct`*:: +*`linux.pressure.cpu.some.300.pct`*:: + -- The average share of time in which at least some tasks were stalled on CPU over a three hundred second window. @@ -43558,17 +43551,17 @@ format: percent -- -*`linux.pressure.pressure.cpu.some.total.time.us`*:: +*`linux.pressure.cpu.some.total.time.us`*:: + -- -The total absolute stall time (in us) in which at least some tasks were stalled on CPU. +The total absolute stall time (in microseconds) in which at least some tasks were stalled on CPU. type: long -- -*`linux.pressure.pressure.memory.some.10.pct`*:: +*`linux.pressure.memory.some.10.pct`*:: + -- The average share of time in which at least some tasks were stalled on Memory over a ten second window. @@ -43580,10 +43573,10 @@ format: percent -- -*`linux.pressure.pressure.memory.some.60.pct`*:: +*`linux.pressure.memory.some.60.pct`*:: + -- -The average share of time in which at least some tasks were stalled on Memory over a 60.pct second window. +The average share of time in which at least some tasks were stalled on Memory over a sixty second window. type: float @@ -43592,7 +43585,7 @@ format: percent -- -*`linux.pressure.pressure.memory.some.300.pct`*:: +*`linux.pressure.memory.some.300.pct`*:: + -- The average share of time in which at least some tasks were stalled on Memory over a three hundred second window. @@ -43604,17 +43597,17 @@ format: percent -- -*`linux.pressure.pressure.memory.some.total.time.us`*:: +*`linux.pressure.memory.some.total.time.us`*:: + -- -The total absolute stall time (in us) in which at least some tasks were stalled on memory. +The total absolute stall time (in microseconds) in which at least some tasks were stalled on memory. type: long -- -*`linux.pressure.pressure.memory.full.10.pct`*:: +*`linux.pressure.memory.full.10.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a ten second window. @@ -43626,7 +43619,7 @@ format: percent -- -*`linux.pressure.pressure.memory.full.60.pct`*:: +*`linux.pressure.memory.full.60.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a sixty second window. @@ -43638,7 +43631,7 @@ format: percent -- -*`linux.pressure.pressure.memory.full.300.pct`*:: +*`linux.pressure.memory.full.300.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a three hundred second window. @@ -43650,17 +43643,17 @@ format: percent -- -*`linux.pressure.pressure.memory.full.total.time.us`*:: +*`linux.pressure.memory.full.total.time.us`*:: + -- -The total absolute stall time (in us) in which in which all non-idle tasks were stalled on memory. +The total absolute stall time (in microseconds) in which in which all non-idle tasks were stalled on memory. type: long -- -*`linux.pressure.pressure.io.some.10.pct`*:: +*`linux.pressure.io.some.10.pct`*:: + -- The average share of time in which at least some tasks were stalled on io over a ten second window. @@ -43672,10 +43665,10 @@ format: percent -- -*`linux.pressure.pressure.io.some.60.pct`*:: +*`linux.pressure.io.some.60.pct`*:: + -- -The average share of time in which at least some tasks were stalled on io over a 60.pct second window. +The average share of time in which at least some tasks were stalled on io over a sixty second window. type: float @@ -43684,7 +43677,7 @@ format: percent -- -*`linux.pressure.pressure.io.some.300.pct`*:: +*`linux.pressure.io.some.300.pct`*:: + -- The average share of time in which at least some tasks were stalled on io over a three hundred second window. @@ -43696,17 +43689,17 @@ format: percent -- -*`linux.pressure.pressure.io.some.total.time.us`*:: +*`linux.pressure.io.some.total.time.us`*:: + -- -The total absolute stall time (in us) in which at least some tasks were stalled on io. +The total absolute stall time (in microseconds) in which at least some tasks were stalled on io. type: long -- -*`linux.pressure.pressure.io.full.10.pct`*:: +*`linux.pressure.io.full.10.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a ten second window. @@ -43718,7 +43711,7 @@ format: percent -- -*`linux.pressure.pressure.io.full.60.pct`*:: +*`linux.pressure.io.full.60.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a sixty second window. @@ -43730,7 +43723,7 @@ format: percent -- -*`linux.pressure.pressure.io.full.300.pct`*:: +*`linux.pressure.io.full.300.pct`*:: + -- The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a three hundred second window. @@ -43742,10 +43735,10 @@ format: percent -- -*`linux.pressure.pressure.io.full.total.time.us`*:: +*`linux.pressure.io.full.total.time.us`*:: + -- -The total absolute stall time (in us) in which in which all non-idle tasks were stalled on io. +The total absolute stall time (in microseconds) in which in which all non-idle tasks were stalled on io. type: long diff --git a/metricbeat/module/linux/fields.go b/metricbeat/module/linux/fields.go index 0118a3f6ced3..0094cc54fc04 100644 --- a/metricbeat/module/linux/fields.go +++ b/metricbeat/module/linux/fields.go @@ -32,5 +32,5 @@ func init() { // AssetLinux returns asset data. // This is the base64 encoded zlib format compressed contents of module/linux. func AssetLinux() string { - return "eJzcmluP27gVx9/nUxwMUGCzSJyZZDe7Ow8F0s6iWLRpg2b3pUUr0OSRxZoiFV7s8X76gqRky7ZkyRcpzvglyNjm+Z0/D8+F8iuY4+oBBJfu6QbAcivwAW7D/29vADQKJAYfYIqW3AAwNFTzwnIlH+CPNwAQvwu5Yk7gDUDKUTDzEN56BZLkuFnev+yqwAeYaeWK8i8Na27WNStjMYccrebUlG/WbdTtUCWl1YTO1+802fOvXb+qVwuLfzUtvgtShzEuz4lebb3XhtNh2r/K5UClINNkDQPGEsuN5dS8DJ9BBoRqZQz8+eNvQJVGs7NWE3QdnGm1y7YhF0rOGt7sgPevgtA5WhOWL5ABcwhWbWSFlHDBncZWMCRarJKB8DYcKK3muAG1CnIyR9BK5ZAqDRKXoOSerjXQuMIAlBUbl2AzrEFbMhXtyqXKSTYAjnGUojGpE2IFBommGbJW9ysaPpOqYZsvF2IGUQIRGglbBY2Q2riRZGefd49nDVIa1DbxQYlDSPd3l09R++Nc7ekyQ40guLGl8eqfyAAHUBdE8DMh95ffU9RmxAIlUioLU4SgYoM26wQY4i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mJ/2PGT5d7thXqOFe1nu5i+BSAa86whFCzcxKsfJ/V3D3tX+QvHwwnXE5VuvSjOisXoT4Gf8+K6RWPBOsuDhwBIzL185Bkcg8zv9z0+fwqgNBCzK6k+RllwytWy+olhb++6qrTX8i131svft3VUbbDNfJjInmUbWy/BwezPxyid7W2FrDetgX5ALZGqUcLZKz9rrfqrV+nV/X6ubTSqv3q41WctroX75Wrf5ClN22+bOWVu3+hoTd+eo++Zu3fyrS99DF+Tls9QJcWkZvLFRCJBKvuJMHDYRDM+dsESickY8M7GDKy4ssc/mir75Hpxxafl+vsB4ZhkIXrmoMtDfJc0GcnW1zZyrnvle2Xphud7P1s4JXVl7acnc82j7Zmxl9kVlazebWw269mbN1WmNunLBhSXuWVzQJ5+vvjm3B8Iz0vy6m7JP9z8CAAD//wf37qw=" } diff --git a/metricbeat/module/linux/pressure/_meta/fields.yml b/metricbeat/module/linux/pressure/_meta/fields.yml index c9840de7f341..cf3220f3030f 100644 --- a/metricbeat/module/linux/pressure/_meta/fields.yml +++ b/metricbeat/module/linux/pressure/_meta/fields.yml @@ -1,105 +1,100 @@ - name: pressure type: group release: beta - description: > - Linux pressure stall information metrics for cpu, memory, and io + description: Linux pressure stall information metrics for cpu, memory, and io fields: - - name: pressure - type: group - description: Linux pressure stall information - fields: - - name: cpu.some.10.pct - type: float - format: percent - description: > - The average share of time in which at least some tasks were stalled on CPU over a ten second window. - - name: cpu.some.60.pct - type: float - format: percent - description: > - The average share of time in which at least some tasks were stalled on CPU over a sixty second window. - - name: cpu.some.300.pct - type: float - format: percent - description: > - The average share of time in which at least some tasks were stalled on CPU over a three hundred second window. - - name: cpu.some.total.time.us - type: long - description: > - The total absolute stall time (in us) in which at least some tasks were stalled on CPU. - - name: memory.some.10.pct - type: float - format: percent - description: > - The average share of time in which at least some tasks were stalled on Memory over a ten second window. - - name: memory.some.60.pct - type: float - format: percent - description: > - The average share of time in which at least some tasks were stalled on Memory over a 60.pct second window. - - name: memory.some.300.pct - type: float - format: percent - description: > - The average share of time in which at least some tasks were stalled on Memory over a three hundred second window. - - name: memory.some.total.time.us - type: long - description: > - The total absolute stall time (in us) in which at least some tasks were stalled on memory. - - name: memory.full.10.pct - type: float - format: percent - description: > - The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a ten second window. - - name: memory.full.60.pct - type: float - format: percent - description: > - The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a sixty second window. - - name: memory.full.300.pct - type: float - format: percent - description: > - The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a three hundred second window. - - name: memory.full.total.time.us - type: long - description: > - The total absolute stall time (in us) in which in which all non-idle tasks were stalled on memory. - - name: io.some.10.pct - type: float - format: percent - description: > - The average share of time in which at least some tasks were stalled on io over a ten second window. - - name: io.some.60.pct - type: float - format: percent - description: > - The average share of time in which at least some tasks were stalled on io over a 60.pct second window. - - name: io.some.300.pct - type: float - format: percent - description: > - The average share of time in which at least some tasks were stalled on io over a three hundred second window. - - name: io.some.total.time.us - type: long - description: > - The total absolute stall time (in us) in which at least some tasks were stalled on io. - - name: io.full.10.pct - type: float - format: percent - description: > - The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a ten second window. - - name: io.full.60.pct - type: float - format: percent - description: > - The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a sixty second window. - - name: io.full.300.pct - type: float - format: percent - description: > - The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a three hundred second window. - - name: io.full.total.time.us - type: long - description: > - The total absolute stall time (in us) in which in which all non-idle tasks were stalled on io. + - name: cpu.some.10.pct + type: float + format: percent + description: > + The average share of time in which at least some tasks were stalled on CPU over a ten second window. + - name: cpu.some.60.pct + type: float + format: percent + description: > + The average share of time in which at least some tasks were stalled on CPU over a sixty second window. + - name: cpu.some.300.pct + type: float + format: percent + description: > + The average share of time in which at least some tasks were stalled on CPU over a three hundred second window. + - name: cpu.some.total.time.us + type: long + description: > + The total absolute stall time (in microseconds) in which at least some tasks were stalled on CPU. + - name: memory.some.10.pct + type: float + format: percent + description: > + The average share of time in which at least some tasks were stalled on Memory over a ten second window. + - name: memory.some.60.pct + type: float + format: percent + description: > + The average share of time in which at least some tasks were stalled on Memory over a sixty second window. + - name: memory.some.300.pct + type: float + format: percent + description: > + The average share of time in which at least some tasks were stalled on Memory over a three hundred second window. + - name: memory.some.total.time.us + type: long + description: > + The total absolute stall time (in microseconds) in which at least some tasks were stalled on memory. + - name: memory.full.10.pct + type: float + format: percent + description: > + The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a ten second window. + - name: memory.full.60.pct + type: float + format: percent + description: > + The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a sixty second window. + - name: memory.full.300.pct + type: float + format: percent + description: > + The average share of time in which in which all non-idle tasks were stalled on memory simultaneously over a three hundred second window. + - name: memory.full.total.time.us + type: long + description: > + The total absolute stall time (in microseconds) in which in which all non-idle tasks were stalled on memory. + - name: io.some.10.pct + type: float + format: percent + description: > + The average share of time in which at least some tasks were stalled on io over a ten second window. + - name: io.some.60.pct + type: float + format: percent + description: > + The average share of time in which at least some tasks were stalled on io over a sixty second window. + - name: io.some.300.pct + type: float + format: percent + description: > + The average share of time in which at least some tasks were stalled on io over a three hundred second window. + - name: io.some.total.time.us + type: long + description: > + The total absolute stall time (in microseconds) in which at least some tasks were stalled on io. + - name: io.full.10.pct + type: float + format: percent + description: > + The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a ten second window. + - name: io.full.60.pct + type: float + format: percent + description: > + The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a sixty second window. + - name: io.full.300.pct + type: float + format: percent + description: > + The average share of time in which in which all non-idle tasks were stalled on io simultaneously over a three hundred second window. + - name: io.full.total.time.us + type: long + description: > + The total absolute stall time (in microseconds) in which in which all non-idle tasks were stalled on io.