DirectPV nodes export Prometheus compatible metrics data via port 10443
. The metrics data includes
drive
, tenant
, volumeID
and node
.To scrape data in Prometheus, each node must be accessible by port 10443
. A simple example is below
$ kubectl -n directpv port-forward node-server-4nd6q 8080:10443
directpv_stats_bytes_total{node="node-3"}
promQL in Prometheus web interface.Below is an example comprehensive YAML configuration:
global:
scrape_interval: 15s
external_labels:
monitor: 'directpv-monitor'
scrape_configs:
- job_name: 'directpv-metrics'
scheme: http
metrics_path: /directpv/metrics
authorization:
credentials_file: /var/run/secrets/kubernetes.io/serviceaccount/token
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_namespace]
regex: "directpv-(.+)"
action: keep
- source_labels: [__meta_kubernetes_pod_controller_kind]
regex: "DaemonSet"
action: keep
- source_labels: [__meta_kubernetes_pod_container_port_name]
regex: "healthz"
action: drop
target_label: kubernetes_port_name
- job_name: 'kubernetes-cadvisor'
scheme: https
metrics_path: /metrics/cadvisor
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
authorization:
credentials_file: /var/run/secrets/kubernetes.io/serviceaccount/token
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_service_name]
action: replace
target_label: kubernetes_name