prometheuspromqlprometheus-node-exporter

Promql simple join queries


I'm trying to join queries:

node_filesystem_avail_bytes{instance="myhost"} and node_filesystem_size_bytes{instance="myhost"}

I tried:

(node_filesystem_avail_bytes{instance="myhost"} ) + on(device,instance) group_left(size) (node_filesystem_size_bytes{instance="myhost"})

The trouble is that size label doesn't show up in the query result

These are the results of each query:

node_filesystem_avail_bytes{_tmp_assetalias="tmp", assetalias="Observability", assetid="1",device="/dev/mapper/vg_raid10-lv_storage_array", fstype="xfs", instance="myhost", job="datacenter-node", mountpoint="/storage_array", sg="prod-cluster1"}
3161558106112
node_filesystem_avail_bytes{_tmp_assetalias="tmp", assetalias="Observability", assetid="1", device="/dev/rbd0", fstype="xfs", instance="myhost",  job="datacenter-node", mountpoint="/var/lib/jenkins", sg="prod-cluster1"}
490332598272
node_filesystem_avail_bytes{_tmp_assetalias="tmp", assetalias="Observability", assetid="1", device="/dev/sda1", fstype="vfat", instance="myhost",  job="datacenter-node", mountpoint="/boot/efi", sg="prod-cluster1"}

node_filesystem_size_bytes{_tmp_assetalias="tmp", assetalias="Observability", assetid="1", device="/dev/mapper/vg_raid10-lv_storage_array", fstype="xfs", instance="myhost", job="datacenter-node", mountpoint="/storage_array", sg="prod-cluster1"}
3197869645824
node_filesystem_size_bytes{_tmp_assetalias="tmp", assetalias="Observability", assetid="1",  device="/dev/rbd0", fstype="xfs", instance="myhost", job="datacenter-node", mountpoint="/var/lib/jenkins", sg="prod-cluster1"}
5495421140992
node_filesystem_size_bytes{_tmp_assetalias="tmp", assetalias="Observability", assetid="1", device="/dev/sda1", fstype="vfat", instance="myhost", job="datacenter-node", mountpoint="/boot/efi", sg="prod-cluster1"}

Solution

  • There is no size label in node_filesystem_size_bytes metric. If you want converting the metric value to size label, then this isn't supported by PromQL, mostly because the size label will have potentially unbound number of possible values, so this may result in high cardinality issues.