Can a panel keep metrics from the past as a replacement of "now" missing metrics?

Hi everyone,

I’m using the tool zfs_exporter to publish ZFS-related metrics into Prometheus and Grafana to visualize some of those metrics. The special thing about my use-case is that I have multiple ZFS pools, but one of those is regularly removed from the system. zfs_exporter properly retrieves metrics from all the available ZFS-pools, which means that whenever one of my pools is exported and not available any more, metrics of that are not retrieved. If it is available, metrics are properly forwarded for that as well. The reason simply is that it’s an external backup harddisk, which gets unmounted to be replaced at any time and then mounted as necessary again.

The panel in Grafana contains gaps in those cases, though because the disk was unmounted/ejected, I know that within the timeframe of the gaps things just can’t have changed at all. Already asked the maintainer of zfs_exporter if that is capable of forwarding cached data or last goown known one or something, bad sadly it isn’t.

Is Grafana somehow able to fill gaps with last received metrics data?

Thanks!

Hi, you can use PromQL function last over time. Here I answered the question how (I understand) it works, so it might be a good solution for you

Thanks a lot, that seems exactly like what I wanted to have:

count(last_over_time(zfs_dataset_written_bytes{pool="zpool-bak",type="filesystem"}[36h]))

1 Like