Git Product home page Git Product logo

prometheus-lvm-exporter's Introduction

LVM metrics for Prometheus

Latest release Release workflow CI workflow Go reference

Prometheus exporter for the Logical Volume Manager (LVM, Wikipedia). It is only compatible with Linux and has been tested with LVM 2.03. All fields related to physical volumes, volume groups and logical volumes are reported, either as a standalone metric for numeric values or as a label on a per-entity info metric.

Usage

prometheus-lvm-exporter listens on TCP port 9845 by default. To listen on another address use the -web.listen-address flag (e.g. -web.listen-address=127.0.0.1:3000).

TLS and HTTP basic authentication is supported through the Prometheus exporter toolkit. A configuration file can be passed to the -web.config flag (documentation).

See the --help output for more flags.

Installation

Pre-built binaries are provided for all releases:

  • Binary archives (.tar.gz)
  • Debian/Ubuntu (.deb)
  • RHEL/Fedora (.rpm)

With the source being available it's also possible to produce custom builds directly using Go or GoReleaser.

Example metrics

lvm_pv_info{pv_fmt="lvm2",pv_name="/dev/sda1",pv_uuid="yc1zVe-…"} 1
lvm_pv_info{pv_fmt="lvm2",pv_name="/dev/sdb1",pv_uuid="WVIH97-…"} 1

lvm_pv_free_bytes{pv_uuid="WVIH97-…"} 9.14358272e+08
lvm_pv_free_bytes{pv_uuid="yc1zVe-…"} 1.040187392e+09

lvm_lv_size_bytes{lv_uuid="BUfEXc-…"} 1.30023424e+08
lvm_lv_size_bytes{lv_uuid="ijb7Yx-…"} 4.194304e+06

More examples can be found in the testdata files.

prometheus-lvm-exporter's People

Contributors

dependabot[bot] avatar dsnt02518 avatar hansmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

prometheus-lvm-exporter's Issues

lv_lockargs parsing error

Hello,
I have a shared VG using sanlock. When scaping this exporter, I have those messages:

2023/06/28 22:21:12 Scrape failed: 28 error(s) occurred:
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:562036736": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:570425344": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:578813952": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:587202560": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:595591168": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:603979776": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:612368384": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:620756992": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:629145600": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:637534208": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:645922816": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:654311424": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:662700032": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:671088640": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:679477248": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:687865856": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:696254464": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:704643072": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:713031680": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:721420288": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:729808896": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:738197504": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:746586112": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:754974720": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:763363328": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:771751936": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:780140544": invalid syntax
* field lv_lockargs: strconv.ParseFloat: parsing "1.0.0:788529152": invalid syntax

kernel minor and major numbers should be part of info metrics

Right now there are metrics lvm_lv_kernel_minor and lvm_lv_kernel_major (and same for vg and pv).
It is really hard to join those metrics to anything, as promql does not really offer anything to join label value and metric value.
Also, those are not things that change frequently, should be in _info metrics.
Same as for example node_exporter adds major and minor labels to node_disk_info metric.

Ancestors/Descendents not parsed correctly

I've just been looking at using this for monitoring our LVM snapshot usage, and found that running with snapshots causes a scrape parse error:

lvm_up{status="4 error(s) occurred:\n* field lv_ancestors: strconv.ParseFloat: parsing \"lv_home\": invalid syntax\n* field lv_descendants: strconv.ParseFloat: parsing \"test_snapshot\": invalid syntax\n* field lv_full_ancestors: strconv.ParseFloat: parsing \"lv_home\": invalid syntax\n* field lv_full_descendants: strconv.ParseFloat: parsing \"test_snapshot\": invalid syntax"} 0

It seems that the fields lv_ancestors, lv_descendants, lv_full_ancestors and lv_full_descendants are being parsed as metrics, when they should be considered information fields. Moving these fields from metricFields into infoFields seems to resolve the issue.

lvm_up metric error

Hello,

Thank you for your work, lvm_exporter work fine.

Just I have an error with some servers with lvm_up metric :

# HELP lvm_up Whether scrape was successful
# TYPE lvm_up gauge
lvm_up{status="5 error(s) occurred:\n* field copy_percent: strconv.ParseFloat: parsing \"0,00\": invalid syntax\n* field data_percent: strconv.ParseFloat: parsing \"12,33\": invalid syntax\n* field metadata_percent: strconv.ParseFloat: parsing \"27,67\": invalid syntax\n* field snap_percent: strconv.ParseFloat: parsing \"12,33\": invalid syntax\n* field sync_percent: strconv.ParseFloat: parsing \"0,00\": invalid syntax"} 0
[root@server prometheus-lvm-exporter_0.3.2_linux_amd64]# ./prometheus-lvm-exporter
2022/12/07 16:22:12 LVM command: /usr/sbin/lvm fullreport --all --config 'global/suffix=false global/units=b report/binary_values_as_numeric=1 report/output_format=json report/buffered=false report/time_format=%s' --configreport pv --options pv_uuid,pv_name,pv_all --configreport lv --options lv_uuid,lv_name,lv_all --configreport vg --options vg_uuid,vg_name,vg_all --configreport seg --options -all --configreport pvseg --options -all
2022/12/07 16:22:12 level=info msg="Listening on" address=[::]:9845
2022/12/07 16:22:12 level=info msg="TLS is disabled." http2=false address=[::]:9845
WARNING: Ignoring duplicate config value: system_id_source
  WARNING: Ignoring duplicate config value: system_id_source
  WARNING: Ignoring duplicate config value: system_id_source
2022/12/07 16:22:18 Scrape failed: 5 error(s) occurred:
* field copy_percent: strconv.ParseFloat: parsing "0,00": invalid syntax
* field data_percent: strconv.ParseFloat: parsing "12,33": invalid syntax
* field metadata_percent: strconv.ParseFloat: parsing "27,67": invalid syntax
* field snap_percent: strconv.ParseFloat: parsing "12,33": invalid syntax
* field sync_percent: strconv.ParseFloat: parsing "0,00": invalid syntax
...

Do you need more informations ?

Regards,

Bad use of labels

Hello,

I see that you defined special metrics lvm_lv_info, lvm_vg_info and lvm_pv_info which useful data is contained in the labels, and which value is always 1. The other metrics label is only the UUID.

This is a bad metric design, as labels should be used to filter metrics, not to carry new information. Also some labels like lv_attr are by nature very volatile (it will change when activating/deactivating the volume for example) which leads to harmful multiplication of timeseries, as this extract from prometheus doc reminds:

CAUTION: Remember that every unique combination of key-value label pairs represents a new time series, which can dramatically increase the amount of data stored. Do not use labels to store dimensions with high cardinality (many different label values), such as user IDs, email addresses, or other unbounded sets of values.

Also, UUID as only label on the other metrics makes data querying very complex.

I suggest dropping the *_info metrics and adding a setting allowing the user to include the needed labels on the other metrics.

Problem parsing VDO fields: online

lvm exporter has trouble parsing some values, and reports 4 errors (but logs just two):

Jun 26 08:31:55 xxx prometheus-lvm-exporter[19726]: 2023/06/26 08:31:55 Scrape failed: 4 error(s) occurred:
Jun 26 08:31:55 xxx prometheus-lvm-exporter[19726]: * field vdo_compression_state: strconv.ParseFloat: parsing "online": invalid syntax
Jun 26 08:31:55 xxx prometheus-lvm-exporter[19726]: * field vdo_index_state: strconv.ParseFloat: parsing "online": invalid syntax
Jun 26 08:32:08 xxx prometheus-lvm-exporter[19726]: 2023/06/26 08:32:08 Scrape failed: 4 error(s) occurred:
Jun 26 08:32:08 xxx prometheus-lvm-exporter[19726]: * field vdo_compression_state: strconv.ParseFloat: parsing "online": invalid syntax
Jun 26 08:32:08 xxx prometheus-lvm-exporter[19726]: * field vdo_index_state: strconv.ParseFloat: parsing "online": invalid syntax

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.