100 - (sum(node_filesystem_avail_bytes{mountpoint="/tmp"}) by (instance)/(sum(node_filesystem_size_bytes{mountpoint="/tmp"}) by (instance))* 100)

this gives me: the percentage of file usage on a particular mount ie tmp grouped per instance output of prom query

But what I need is some regex or some way to have % on tmp var opt and everything grouped per instance. I don't want to write separate queries for each. Is there a way to achieve this? So I have currently is.

tmp node A percentage
tmp node B percentage

what I want is.

tmp node A percentage
tmp node B percentage
var node A percentage
var node B percentage
and so on.

In a single query?

1

There are 1 best solutions below

2
On

Remove the "mountpoint="/tmp"" and add "mountpoint" in the "by" clause:

100 - (sum(node_filesystem_avail_bytes) by (instance, mountpoint)/(sum(node_filesystem_size_bytes) by (instance, mountpoint))* 100)