Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add kubernetes.volume.fs.used.pct field #23564

Merged
merged 2 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Honor kube event resysncs to handle missed watch events {pull}22668[22668]
- Add autodiscover provider and metadata processor for Nomad. {pull}14954[14954] {pull}23324[23324]
- Add `processors.rate_limit.n.dropped` monitoring counter metric for the `rate_limit` processor. {pull}23330[23330]
- Add kubernetes.volume.fs.used.pct field. {pull}23564[23564]

*Auditbeat*

Expand Down
12 changes: 12 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30873,6 +30873,18 @@ format: bytes

--

*`kubernetes.volume.fs.used.pct`*::
+
--
Percentage of used storage


type: scaled_float

format: percent

--


*`kubernetes.volume.fs.inodes.used`*::
+
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/kubernetes/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions metricbeat/module/kubernetes/volume/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
format: bytes
description: >
Filesystem total used in bytes
- name: pct
type: scaled_float
format: percent
description: >
Percentage of used storage
- name: inodes
type: group
fields:
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/module/kubernetes/volume/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ func eventMapping(content []byte) ([]common.MapStr, error) {
},
},
}
if volume.CapacityBytes > 0 {
volumeEvent.Put("fs.used.pct", float64(volume.UsedBytes)/float64(volume.CapacityBytes))
}
events = append(events, volumeEvent)
}

Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/kubernetes/volume/volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func TestEventMapping(t *testing.T) {
"fs.available.bytes": 1939689472,
"fs.capacity.bytes": 1939701760,
"fs.used.bytes": 12288,
"fs.used.pct": float64(12288) / float64(1939701760),
"fs.inodes.used": 9,
"fs.inodes.free": 473551,
"fs.inodes.count": 473560,
Expand Down