zfs_exporter

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2022 License: BSD-2-Clause Imports: 12 Imported by: 0

README

zfs_exporter

Monitors a pool, returning various ZFS properties such as the pool's size and allocation.

Usage

Simply go get -u github.com/FoxNetworking/zfs_exporter. This will produce a binary at ~/go/bin/zfs_exporter (unless configured otherwise.)

Use the following flags to configure to your situation:

  -web.listen-address string
    	Address on which to expose metrics and web interface. (default ":9312")
  -web.telemetry-path string
    	Path under which to expose metrics. (default "/metrics")
  -zfs.zpool-path string
    	Path to execute the zpool binary. (default "/sbin/zpool")

Note that if /sbin/zpool does not exist, the zpool binary will be search for in $PATH. Ensure this is properly configured if your zpool binary is in a non-standard location.

Start the service.

You can then add this endpoint as an exporter to Prometheus:

scrape_configs:
  - job_name: 'zfs'
    static_configs:
    - targets: ['[::1]:9312']

This will give you four new gauge metrics:

  • zfs_pool_allocated, the pool's allocated space, in bytes
  • zfs_pool_size, the pool's used space, in bytes
  • zfs_pool_free, the pool's free space, in bytes
  • zfs_pool_capacity, the capacity reported by ZFS as a whole number, out of 100

You can apply these to a graph in various systems and use to whatever fits your situation best.

Grafana graph containing these two keys

Wishlist
  • Find a nicer way to scrape command output
  • Handle removing pools nicely
  • Query /dev/zfs directly via ioctls in order to avoid libzfs
  • Expose more metrics - PRs/feature requests via issues welcome!

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL