Skip to content

Commit

Permalink
feat: export vg name in node_physical_volume_size for lvm collector
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas M <[email protected]>
  • Loading branch information
lukasmrtvy authored Dec 19, 2023
1 parent 3018120 commit f720d08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lvm-prom-collector
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ if [ "$physical" = true ]; then
echo "# HELP node_physical_volume_free Physical volume free space in bytes"
echo "# TYPE node_physical_volume_free gauge"

pvs_output=$(pvs --noheadings --units b --nosuffix --nameprefixes --unquoted --options pv_name,pv_fmt,pv_free,pv_size,pv_uuid 2>/dev/null)
pvs_output=$(pvs --noheadings --units b --nosuffix --nameprefixes --unquoted --options pv_name,vg_name,pv_fmt,pv_free,pv_size,pv_uuid 2>/dev/null)
echo "$pvs_output" | while IFS= read -r line; do
# Skip if the line is empty
[ -z "$line" ] && continue
# shellcheck disable=SC2086
declare $line
echo "node_physical_volume_size{name=\"$LVM2_PV_NAME\", uuid=\"$LVM2_PV_UUID\", format=\"$LVM2_PV_FMT\"} $LVM2_PV_SIZE"
echo "node_physical_volume_free{name=\"$LVM2_PV_NAME\", uuid=\"$LVM2_PV_UUID\", format=\"$LVM2_PV_FMT\"} $LVM2_PV_FREE"
echo "node_physical_volume_free{name=\"$LVM2_PV_NAME\",vg_name=\"$LVM2_VG_NAME\" uuid=\"$LVM2_PV_UUID\", format=\"$LVM2_PV_FMT\"} $LVM2_PV_FREE"
done
fi

Expand Down

0 comments on commit f720d08

Please sign in to comment.