From 125c29d28e1cf718aac4d8589406097707819458 Mon Sep 17 00:00:00 2001 From: Ioannis Androulidakis Date: Tue, 16 Feb 2021 14:29:40 +0200 Subject: [PATCH] [Metricbeat][Kubernetes] Extend state_node with more conditions (#23905) --- CHANGELOG.next.asciidoc | 1 + metricbeat/docs/fields.asciidoc | 40 +++++++++++++++++++ metricbeat/helper/prometheus/metric.go | 29 ++++++++------ .../helper/prometheus/prometheus_test.go | 33 +++++++++++++-- metricbeat/module/kubernetes/fields.go | 2 +- .../kubernetes/state_node/_meta/fields.yml | 16 ++++++++ .../state_node/_meta/test/ksm.v1.3.0.expected | 3 ++ .../state_node/_meta/test/ksm.v1.8.0.expected | 3 ++ .../kubernetes/state_node/state_node.go | 14 ++++--- 9 files changed, 120 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 8ab8d10c7f2..5f353ec1b2c 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -126,6 +126,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - kubernetes.container.cpu.limit.cores and kubernetes.container.cpu.requests.cores are now floats. {issue}11975[11975] - Change types of numeric metrics from Kubelet summary api to double so as to cover big numbers. {pull}23335[23335] - Add container.image.name and containe.name ECS fields for state_container. {pull}23802[23802] +- Add support for the MemoryPressure, DiskPressure, OutOfDisk and PIDPressure status conditions in state_node. {pull}[23905] *Packetbeat* diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index e3359559097..4af8bbf459f 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -29807,6 +29807,46 @@ type: keyword Node unschedulable status +type: boolean + +-- + +*`kubernetes.node.status.memory_pressure`*:: ++ +-- +Node MemoryPressure status + + +type: boolean + +-- + +*`kubernetes.node.status.disk_pressure`*:: ++ +-- +Node DiskPressure status + + +type: boolean + +-- + +*`kubernetes.node.status.out_of_disk`*:: ++ +-- +Node OutOfDisk status + + +type: boolean + +-- + +*`kubernetes.node.status.pid_pressure`*:: ++ +-- +Node PIDPressure status + + type: boolean -- diff --git a/metricbeat/helper/prometheus/metric.go b/metricbeat/helper/prometheus/metric.go index a040ed65dae..5f3f1199f31 100644 --- a/metricbeat/helper/prometheus/metric.go +++ b/metricbeat/helper/prometheus/metric.go @@ -79,10 +79,11 @@ type MetricOption interface { Process(field string, value interface{}, labels common.MapStr) (string, interface{}, common.MapStr) } -// OpFilter only processes metrics matching the given filter -func OpFilter(filter map[string]string) MetricOption { - return opFilter{ - labels: filter, +// OpFilterMap only processes metrics matching the given filter +func OpFilterMap(label string, filterMap map[string]string) MetricOption { + return opFilterMap{ + label: label, + filterMap: filterMap, } } @@ -331,18 +332,22 @@ func (m *infoMetric) GetField() string { return "" } -type opFilter struct { - labels map[string]string +type opFilterMap struct { + label string + filterMap map[string]string } -// Process will return nil if labels don't match the filter -func (o opFilter) Process(field string, value interface{}, labels common.MapStr) (string, interface{}, common.MapStr) { - for k, v := range o.labels { - if labels[k] != v { - return "", nil, nil +// Called by the Prometheus helper to apply extra options on retrieved metrics +// Check whether the value of the specified label is allowed and, if yes, return the metric via the specified mapped field +// Else, if the specified label does not match the filter, return nil +// This is useful in cases where multiple Metricbeat fields need to be defined per Prometheus metric, based on label values +func (o opFilterMap) Process(field string, value interface{}, labels common.MapStr) (string, interface{}, common.MapStr) { + for k, v := range o.filterMap { + if labels[o.label] == k { + return fmt.Sprintf("%v.%v", field, v), value, labels } } - return field, value, labels + return "", nil, nil } type opLowercaseValue struct{} diff --git a/metricbeat/helper/prometheus/prometheus_test.go b/metricbeat/helper/prometheus/prometheus_test.go index 974f51f1a10..f044c2f422f 100644 --- a/metricbeat/helper/prometheus/prometheus_test.go +++ b/metricbeat/helper/prometheus/prometheus_test.go @@ -397,9 +397,36 @@ func TestPrometheus(t *testing.T) { msg: "Label metrics, filter", mapping: &MetricsMapping{ Metrics: map[string]MetricMap{ - "first_metric": LabelMetric("first.metric", "label4", OpLowercaseValue(), OpFilter(map[string]string{ - "foo": "filtered", - })), + "first_metric": LabelMetric("first.metric", "label4", OpFilterMap( + "label1", + map[string]string{"value1": "foo"}, + )), + }, + Labels: map[string]LabelMap{ + "label1": Label("labels.label1"), + }, + }, + expected: []common.MapStr{ + common.MapStr{ + "first": common.MapStr{ + "metric": common.MapStr{ + "foo": "FOO", + }, + }, + "labels": common.MapStr{ + "label1": "value1", + }, + }, + }, + }, + { + msg: "Label metrics, filter", + mapping: &MetricsMapping{ + Metrics: map[string]MetricMap{ + "first_metric": LabelMetric("first.metric", "label4", OpLowercaseValue(), OpFilterMap( + "foo", + map[string]string{"Filtered": "filtered"}, + )), }, Labels: map[string]LabelMap{ "label1": Label("labels.label1"), diff --git a/metricbeat/module/kubernetes/fields.go b/metricbeat/module/kubernetes/fields.go index aec239344fd..0b87da7ad9c 100644 --- a/metricbeat/module/kubernetes/fields.go +++ b/metricbeat/module/kubernetes/fields.go @@ -32,5 +32,5 @@ func init() { // AssetKubernetes returns asset data. // This is the base64 encoded gzipped contents of module/kubernetes. func AssetKubernetes() string { - return "eJzsXU9z47aSv8+nQM1psuXosLW1hzlsVeK8t8+VzDyv7ckctrYUmGxJiEmAAUB79D79FsB/IAmAoAjJHls6pDK21f1Dd6PR6AYaP6IH2H9ED+U9cAoSxDuEJJEZfETvf21/+P4dQimIhJNCEkY/ov96hxBC3R+gHCQnifo2hwywgI9oi98hJEBKQrfiI/rf90Jk7y/Q+52Uxfv/U7/bMS7XCaMbsv2INjgT8A6hDYEsFR81gx8RxTkM4KmP3BeKA2dlUf/EAk99ruiG8RyrHyNMUyQklkRIkgjENqhgqUA5pngLKbrfG3xWNQUTjYkIF0QAfwTe/sYGygNsIL+frq9QRdAQZfPpi7T5DKGZ8Dj8VYKQqyQjQGXvTxqcD7B/Yjwd/M6DVn0uNT0E3yAplV4bRsKLgoNgJU8gHo6bijKkyEp7CECU98fE4CI/gpGwIj4ApMmiD0lWCgn8QjMVBU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XsznUiJ6hmXH6LSNj2BDrgvAj21nI9Q3gpeXZe7WyAbZl2HmxrgBxAZ51GEaddmoZ2ZVnz2U6rFxB1QFZ49EEEZH68fZm0WdpC6wMlm49gD0VszaclFhVuytpdTXHao6M3uKc5JgtSatJ5B6R8K+dVXve9wTnVhclMb/laXVSfS0erS90w2hW4RpimqU+FN+z+wTE79+RTCW91dPEhqPpkSZ+C23p2dZwvKUWHvfyX3P58QvFL6Jh9ISZj0vNS18CsAEGVXrHMNMvtwZeEMc1dq+ZBxqlVNMHXVNBixfyptxRzrUdH4TrEf69b/hc3N7G6aK+uWj1//Q0x+jJ54mNFPgLRzx+aDuqmbwk0YnYzT9qFHUo2T982PPFqCPtWKcHLOijd55P3yE9rzt/pp64U/zX24P36l9pSoKeJO9m+c9S/pXqh77a+u2Rry01zCve29f1mcY9GrRaWBCWeo52L3ExJNv+ccIf79UxnI0whhZOfjXJjHI/MQBQsjYCyfFZlPFrzWd/w8AAP//Nny2cA==" } diff --git a/metricbeat/module/kubernetes/state_node/_meta/fields.yml b/metricbeat/module/kubernetes/state_node/_meta/fields.yml index ea0f952089e..b7d5f2a1920 100644 --- a/metricbeat/module/kubernetes/state_node/_meta/fields.yml +++ b/metricbeat/module/kubernetes/state_node/_meta/fields.yml @@ -15,6 +15,22 @@ type: boolean description: > Node unschedulable status + - name: memory_pressure + type: boolean + description: > + Node MemoryPressure status + - name: disk_pressure + type: boolean + description: > + Node DiskPressure status + - name: out_of_disk + type: boolean + description: > + Node OutOfDisk status + - name: pid_pressure + type: boolean + description: > + Node PIDPressure status - name: cpu type: group fields: diff --git a/metricbeat/module/kubernetes/state_node/_meta/test/ksm.v1.3.0.expected b/metricbeat/module/kubernetes/state_node/_meta/test/ksm.v1.3.0.expected index c560b169d77..38a0cc0dae1 100644 --- a/metricbeat/module/kubernetes/state_node/_meta/test/ksm.v1.3.0.expected +++ b/metricbeat/module/kubernetes/state_node/_meta/test/ksm.v1.3.0.expected @@ -29,6 +29,9 @@ } }, "status": { + "disk_pressure": "false", + "memory_pressure": "false", + "out_of_disk": "false", "ready": "true", "unschedulable": false } diff --git a/metricbeat/module/kubernetes/state_node/_meta/test/ksm.v1.8.0.expected b/metricbeat/module/kubernetes/state_node/_meta/test/ksm.v1.8.0.expected index 7b0390a04a2..371c9ca294b 100644 --- a/metricbeat/module/kubernetes/state_node/_meta/test/ksm.v1.8.0.expected +++ b/metricbeat/module/kubernetes/state_node/_meta/test/ksm.v1.8.0.expected @@ -29,6 +29,9 @@ } }, "status": { + "disk_pressure": "false", + "memory_pressure": "false", + "pid_pressure": "false", "ready": "true", "unschedulable": false } diff --git a/metricbeat/module/kubernetes/state_node/state_node.go b/metricbeat/module/kubernetes/state_node/state_node.go index bd334915240..f2a1a6b965e 100644 --- a/metricbeat/module/kubernetes/state_node/state_node.go +++ b/metricbeat/module/kubernetes/state_node/state_node.go @@ -49,12 +49,16 @@ var ( "kube_node_status_allocatable_cpu_cores": p.Metric("cpu.allocatable.cores"), "kube_node_spec_unschedulable": p.BooleanMetric("status.unschedulable"), "kube_node_status_ready": p.LabelMetric("status.ready", "condition"), - "kube_node_status_condition": p.LabelMetric("status.ready", "status", - p.OpFilter(map[string]string{ - "condition": "Ready", - })), + "kube_node_status_condition": p.LabelMetric("status", "status", p.OpFilterMap( + "condition", map[string]string{ + "Ready": "ready", + "MemoryPressure": "memory_pressure", + "DiskPressure": "disk_pressure", + "OutOfDisk": "out_of_disk", + "PIDPressure": "pid_pressure", + }, + )), }, - Labels: map[string]p.LabelMap{ "node": p.KeyLabel("name"), },