Skip to content

lvm-prom-collector: Fix text format error #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sr
Copy link

@sr sr commented Feb 7, 2021

This fixes the following error:

level=error ts=2021-02-07T10:44:19.990Z caller=textfile.go:209 collector=textfile msg="failed to collect textfile data" file=metrics.prom err="failed to parse textfile data from \"/var/lib/node-exporter/lvm.prom\": text format parsing error in line 15: expected float as value, got \"\""

For deactivated thin LVs, the data_percent field is empty, which causes the script to emit a metric without a value.

This handles this case by simply not emitting node_lvm_thin_pools_allocated if data_percent is empty.

Another approach could be to filter out inactive LVs, like this:

lvs --noheadings --select 'lv_attr=~[^t.*] && lv_active=active' --units b --nosuffix --unquoted --nameprefixes --options lv_uuid,vg_name,lv_name,data_percent

However this works just fine and is probably easier to understand.

/cc @badrabubker

@sr sr force-pushed the fix-lvm-thin-pool branch from 50e572f to 2ad7c32 Compare February 7, 2021 15:25
@dswarbrick
Copy link
Member

@sr Can you please rebase this on current master, and confirm whether it is still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants