1

I want to monitor the disk usage% of a specific filesystem in a pod (in grafana). I was wondering if there’s a Prometheus query I can use to do so.

Jay
  • 13
  • 4

2 Answers2

1

To monitor PVC, disk usage %, you can use something like this

100 - (kubelet_volume_stats_available_bytes / kubelet_volume_stats_capacity_bytes) * 100

To monitor file system, disk usage %, you can use something like this

100 - (node_filesystem_avail_bytes / node_filesystem_size_bytes * 100)

Hope this helps.

iamlucas
  • 131
  • 4
  • Thanks, I ended up using `100 * sum(kubelet_volume_stats_used_bytes{persistentvolumeclaim=~”name.*”}) by (persistentvolumeclaim) / sum(kubelet_volume_stats_capacity_bytes) by (persistentvolumeclaim)` – Jay Oct 19 '22 at 13:12
  • The problem is that this produces more timeseries than necessary. Needs to take into account the PVC name – gabopushups Aug 25 '23 at 16:41
0

Taking into account the persistent volume claim name, to avoid having separate timeseries coming from different instances

100 * (sum by (persistentvolumeclaim) (kubelet_volume_stats_used_bytes)) 
    / (sum by (persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes))
gabopushups
  • 185
  • 2
  • 11