containers / prometheus-podman-exporter

Prometheus exporter for podman environments exposing containers, pods, images, volumes and networks information.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add metric for volume storage size

zackman0010 opened this issue · comments

I'd like to be able to monitor the amount of storage currently being utilized by my volumes. Looks like this data should be available:
Command line: podman system df -v
API: https://docs.podman.io/en/latest/_static/api.html#tag/system/operation/SystemDataUsageLibpod

SystemDf(ctx context.Context, options SystemDfOptions) (*SystemDfReport, error)

Looks like SystemDf() uses filepath.WalkDir() which recursively walks over every single file of the volume. I'm not sure if this is a feasible solution for scraping this metrics on a regular basis. At least on my test system with a hand full of volumes it took around 15 seconds to get the size of all volumes. I'm also looking for a way to monitor storage usage of volumes. In my case, all volumes are backed by block devices which can be monitored by node_exporter if the default of excluded mounts is changed to not ignore container volume mount points.
For the case where your volumes are backed by directories i'm not sure if there is an efficient way to get those metric.

I am in same page as @ingobecker , on heavy system scraping disk usage will take a bit time.

Ouch, I didn't realize that's how that worked. Thank you, I'll find another way to get this data!