Skip to content

Commit

Permalink
Add kubernetes.volume.fs.used.pct field (#23564)
Browse files Browse the repository at this point in the history
* Add kubernetes.volume.fs.used.pct field

Signed-off-by: chrismark <chrismarkou92@gmail.com>

* Add changelog entry

Signed-off-by: chrismark <chrismarkou92@gmail.com>
  • Loading branch information
ChrsMark authored Jan 20, 2021
1 parent 616266f commit 29b440f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,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

0 comments on commit 29b440f

Please sign in to comment.