Skip to content

Commit

Permalink
[metricbeat]kubernetes: add kube-state-metrics persistentvolumes (#14859
Browse files Browse the repository at this point in the history
)

kube-state-metrics persistent volumes metrics for kubernetes
  • Loading branch information
Pablo Mercado authored Dec 19, 2019
1 parent eb646c1 commit a586a35
Show file tree
Hide file tree
Showing 18 changed files with 466 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Enable script processor. {pull}14711[14711]
- Enable wildcard for cloudwatch metricset namespace. {pull}14971[14971] {issue}14965[14965]
- Add `kube-state-metrics` `state_service` metrics for kubernetes module. {pull}14794[14794]
- Add `kube-state-metrics` `state_persistentvolume` metrics for kubernetes module. {pull}14859[14859]
- Add `kube-state-metrics` `state_persistentvolumeclaim` metrics for kubernetes module. {pull}15066[15066]
- Add usage metricset in aws modules. {pull}14925[14925] {issue}14935[14935]
- Add billing metricset in aws modules. {pull}14801[14801] {issue}14934[14934]
Expand Down
43 changes: 43 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19296,6 +19296,49 @@ type: long
--
[float]
=== persistentvolume
kubernetes persistent volume metrics from kube-state-metrics
*`kubernetes.persistentvolume.name`*::
+
--
Volume name.
type: keyword
--
*`kubernetes.persistentvolume.capacity.bytes`*::
+
--
Volume capacity
type: long
--
*`kubernetes.persistentvolume.phase`*::
+
--
Volume phase according to kubernetes
type: keyword
--
*`kubernetes.persistentvolume.storage_class`*::
+
--
Storage class for the volume
type: keyword
--
[float]
=== persistentvolumeclaim
Expand Down
1 change: 1 addition & 0 deletions metricbeat/docs/modules/kubernetes.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ metricbeat.modules:
- state_cronjob
- state_resourcequota
- state_service
- state_persistentvolume
- state_persistentvolumeclaim
period: 10s
hosts: ["kube-state-metrics:8080"]
Expand Down
2 changes: 0 additions & 2 deletions metricbeat/helper/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func (p *prometheus) GetProcessedMetrics(mapping *MetricsMapping) ([]common.MapS
event[k] = v
}
events = append(events, event)

}

// fill info from infoMetrics
Expand All @@ -228,7 +227,6 @@ func (p *prometheus) GetProcessedMetrics(mapping *MetricsMapping) ([]common.MapS
}

return events, nil

}

// infoMetricData keeps data about an infoMetric
Expand Down
1 change: 1 addition & 0 deletions metricbeat/include/list_docker.go

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

1 change: 1 addition & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ metricbeat.modules:
- state_cronjob
- state_resourcequota
- state_service
- state_persistentvolume
- state_persistentvolumeclaim
period: 10s
hosts: ["kube-state-metrics:8080"]
Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/kubernetes/_meta/config.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- state_cronjob
- state_resourcequota
- state_service
- state_persistentvolume
- state_persistentvolumeclaim
period: 10s
hosts: ["kube-state-metrics:8080"]
Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/kubernetes/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# - state_cronjob
# - state_resourcequota
# - state_service
# - state_persistentvolume
# - state_persistentvolumeclaim
# period: 10s
# hosts: ["kube-state-metrics:8080"]
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.

32 changes: 32 additions & 0 deletions metricbeat/module/kubernetes/state_persistentvolume/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kube-state-metrics/PersistentVolume


This metricset connects to kube-state-metrics endpoint to retrieve and report Persistent Volume metrics.

## Version history

- November 2019, first release using kube-state-metrics `v1.8.0`.

## Configuration

See the metricset documentation for the configuration reference.

## Manual testing

Running a minikube cluster allows you to create persistent volume using the `/data/` directory at hostpath

```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 5Gi
hostPath:
path: /data/pv0001/
```
Try adding labels, and creating volumes from pods using PVC.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- name: persistentvolume
type: group
description: >
kubernetes persistent volume metrics from kube-state-metrics
release: experimental
fields:
- name: name
type: keyword
description: Volume name.
- name: capacity.bytes
type: long
description: Volume capacity
- name: phase
type: keyword
description: Volume phase according to kubernetes
- name: storage_class
type: keyword
description: Storage class for the volume



Loading

0 comments on commit a586a35

Please sign in to comment.