|
1 | 1 | # monitor-pv |
2 | 2 | custom stats collector for OpenEBS persistent volumes (jiva, localpv) |
| 3 | + |
| 4 | +### Pre-requisite |
| 5 | +- openebs (https://docs.openebs.io/) |
| 6 | + |
| 7 | +### How to use |
| 8 | +- Run `kubectl apply -f node-exporter-pv-metrics.yaml` |
| 9 | +- Verify if the pods are up and running. |
| 10 | +<pre> |
| 11 | +$ kubectl get pods -n openebs |
| 12 | +NAME READY STATUS RESTARTS AGE |
| 13 | +cspc-operator-6c4cc7c64d-698ps 1/1 Running 0 6d23h |
| 14 | +cvc-operator-77d749c559-9phff 1/1 Running 0 6d23h |
| 15 | +maya-apiserver-5fb947d74d-r9skp 1/1 Running 0 6d23h |
| 16 | +<b>monitor-pv-bvzgv 2/2 Running 0 8s |
| 17 | +monitor-pv-nk76b 2/2 Running 0 11s |
| 18 | +monitor-pv-wnvp5 2/2 Running 0 8s</b> |
| 19 | +openebs-admission-server-6c4b4998f8-zcg9n 1/1 Running 0 6d23h |
| 20 | +openebs-localpv-provisioner-5b744fc789-5wr8d 1/1 Running 0 6d23h |
| 21 | +openebs-ndm-g474w 1/1 Running 0 6d23h |
| 22 | +openebs-ndm-k2nnp 1/1 Running 0 6d23h |
| 23 | +openebs-ndm-operator-b58c79cc5-z8zw6 1/1 Running 1 6d23h |
| 24 | +openebs-ndm-rwzrb 1/1 Running 0 6d23h |
| 25 | +openebs-provisioner-54d45b55db-rt5rv 1/1 Running 0 6d23h |
| 26 | +openebs-snapshot-operator-6d4f5d7688-6g7zw 2/2 Running 0 6d23h |
| 27 | +pvc-dd03f0ae-731c-4f78-bdbf-86485f32ab3d-ctrl-89b44f6cb-pbnmk 2/2 Running 0 40h |
| 28 | +pvc-dd03f0ae-731c-4f78-bdbf-86485f32ab3d-rep-1-857b65c68d-qrdx9 1/1 Running 0 40h |
| 29 | +pvc-dd03f0ae-731c-4f78-bdbf-86485f32ab3d-rep-2-58c4f54f7-m6n45 1/1 Running 0 40h |
| 30 | + |
| 31 | +</pre> |
| 32 | + |
| 33 | +### How it works |
| 34 | +The monitor PV daemonset pods consist of two containers i.e node-exporter and monitor-pv. The monitor-pv collects the PV size and PV utilization information & places it in a file on the shared mount. The node exporter uses its text-file collector to expose this data as metrics. |
| 35 | + |
| 36 | +It exposes two metrics **pv_capacity_bytes** and **pv_utilization_bytes**. |
| 37 | + |
| 38 | +### Prometheus Configuration |
| 39 | +To scrape the metrics in prometheus add this configuration in prometheus configuration file: |
| 40 | +<pre> |
| 41 | + - job_name: 'monitor-pv' |
| 42 | + kubernetes_sd_configs: |
| 43 | + - role: pod |
| 44 | + relabel_configs: |
| 45 | + - source_labels: [__meta_kubernetes_pod_label_app] |
| 46 | + regex: monitor-pv |
| 47 | + action: keep |
| 48 | +</pre> |
| 49 | + |
| 50 | +If you want to scrape only monitor-pv metrics and drop all other node-exporter metrics use the below configuration: |
| 51 | +<pre> |
| 52 | + - job_name: 'monitor-pv' |
| 53 | + kubernetes_sd_configs: |
| 54 | + - role: pod |
| 55 | + relabel_configs: |
| 56 | + - source_labels: [__meta_kubernetes_pod_label_app] |
| 57 | + regex: monitor-pv |
| 58 | + action: keep |
| 59 | + metric_relabel_configs: |
| 60 | + - source_labels: [__name__] |
| 61 | + regex: '(pv_capacity_bytes|pv_utilization_bytes)' |
| 62 | + action: keep |
| 63 | +</pre> |
| 64 | + |
| 65 | +### Example: |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
0 commit comments