prometheus-community / node-exporter-textfile-collector-scripts

Scripts for node-exporter's textfile collector
Apache License 2.0
512 stars 191 forks source link

lvm-prom-collector: add metadata to the thin metrics #140

Closed hugosxm closed 1 year ago

hugosxm commented 1 year ago

Hi,

i added the metadata usage for each lvm thin as i found this info crucial for monitoring.

Here is a sample output :

# HELP node_physical_volume_size Physical volume size in bytes
# TYPE node_physical_volume_size gauge
# HELP node_physical_volume_free Physical volume free space in bytes
# TYPE node_physical_volume_free gauge
node_physical_volume_size{name="/dev/md0", uuid="2msKv6-3JnJ-ihKo-w6i5-M1Tj-sddN-yFtFOL", format="lvm2"} 500036534272
node_physical_volume_free{name="/dev/md0", uuid="2msKv6-3JnJ-ihKo-w6i5-M1Tj-sddN-yFtFOL", format="lvm2"} 8518631424
# HELP node_lvm_snapshots_allocated percentage of allocated data to a snapshot
# TYPE node_lvm_snapshots_allocated gauge
# HELP node_lvm_thin_pools_allocated percentage of allocated thin pool data
# TYPE node_lvm_thin_pools_allocated gauge
# HELP node_lvm_thin_pools_metadata percentage of allocated thin pool metadata
# TYPE node_lvm_thin_pools_metadata gauge
node_lvm_thin_pools_allocated{uuid="t2gKmH-8K4K-nwpE-G3CB-DjQS-sjFp-YY7G3L", vgroup="pve"} 52.34
node_lvm_thin_pools_metadata{uuid="t2gKmH-8K4K-nwpE-G3CB-DjQS-sjFp-YY7G3L", vgroup="pve"} 6.09
# HELP node_volume_group_size Volume group size in bytes
# TYPE node_volume_group_size gauge
# HELP node_volume_group_free volume group free space in bytes
# TYPE node_volume_group_free gauge
node_volume_group_size{name="pve"} 500036534272
node_volume_group_free{name="pve"} 8518631424
dswarbrick commented 1 year ago

Thanks for your contribution, however the placement of the additional metric output will technically violate the following criteria of the text exposition format:

All lines for a given metric must be provided as one single group, with the optional HELP and TYPE lines first (in no particular order).

For example, it could lead to a scenario such as this:

# HELP node_lvm_thin_pools_allocated percentage of allocated thin pool data
# TYPE node_lvm_thin_pools_allocated gauge
# HELP node_lvm_thin_pools_metadata percentage of allocated thin pool metadata
# TYPE node_lvm_thin_pools_metadata gauge
node_lvm_thin_pools_allocated{uuid="LVMfoo", vgroup="vg01"} 73.2
node_lvm_thin_pools_metadata{uuid="LVMfoo", vgroup="vg01"} 2.5
node_lvm_thin_pools_allocated{uuid="LVMbar", vgroup="vg01"} 67.1
node_lvm_thin_pools_metadata{uuid="LVMbar", vgroup="vg01"} 1.8
hugosxm commented 1 year ago

Thanks for your contribution, however the placement of the additional metric output will technically violate the following criteria of the text exposition format:

All lines for a given metric must be provided as one single group, with the optional HELP and TYPE lines first (in no particular order).

For example, it could lead to a scenario such as this:

# HELP node_lvm_thin_pools_allocated percentage of allocated thin pool data
# TYPE node_lvm_thin_pools_allocated gauge
# HELP node_lvm_thin_pools_metadata percentage of allocated thin pool metadata
# TYPE node_lvm_thin_pools_metadata gauge
node_lvm_thin_pools_allocated{uuid="LVMfoo", vgroup="vg01"} 73.2
node_lvm_thin_pools_metadata{uuid="LVMfoo", vgroup="vg01"} 2.5
node_lvm_thin_pools_allocated{uuid="LVMbar", vgroup="vg01"} 67.1
node_lvm_thin_pools_metadata{uuid="LVMbar", vgroup="vg01"} 1.8

Hi, I made the change, please see the new version, I think it is good now, sorry for the first try, i was not aware of this !

dswarbrick commented 1 year ago

@hugosxm Please sign off your commits to make DCO happy.