Git Product home page Git Product logo

zfs-exporter's Introduction

zfs-exporter

Prometheus metrics exporter for ZFS.

It's much the same data you get from zpool status and zpool iostat, but in the form of Prometheus metrics. Run

curl -s http://localhost:9254/metrics

to see them.

Sample dashboard is available at grafana.net.

Caveats

Currently doesn't handle pool changes gracefully, you'll have to kill and restart it if you create/import or destroy/export any pools.

libzfs is not a stable or official interface, so this could break with any new ZFS release.

Requires root privileges on Linux. For the security conscious, run it with -web.listen-address=localhost:9254.

If you're not running prometheus on the same host, either use my exporter-proxy or write a little cronjob that does

curl -s http://localhost:9254/metrics > mydir/zfs.tmp && mv mydir/zfs.tmp mydir/zfs.prom

Configure node_exporter with -collector.textfile.directory=mydir and it will publish the stats to allow remote scraping.

See also

https://github.com/eliothedeman/zfs_exporter

Same idea, but implemented by parsing the output of zpool using github.com/mistifyio/go-zfs.

https://github.com/eripa/prometheus-zfs

Ditto but without the dependency on go-zfs.

prometheus/node_exporter#213

PR for node_exporter to add support for ZFS metrics. Currently also relies on shelling out, which is apparently not allowed in node_exporter, so not clear where it's going.

Testing

To build and run zfs-exporter in a virtual environment, you need to install VirtualBox, Vagrant, and Ansible 2.2+. Then

platform=jessie # or fedora25
sudo ansible-galaxy install gantsign.golang
cd zfs-vagrant-ansible/
vagrant up $platform
cd ..
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i zfs-vagrant-ansible/.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory playbook-zfs-exporter.yml -l $platform

zfs-exporter's People

Contributors

ncabatoff avatar tdorsey avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zfs-exporter's Issues

Compiling issues

Hi,

I'm having trouble compiling your zfs exporter.
$ go test in the zfs-exporter directory yields

# github.com/bicomsystems/go-libzfs
could not determine kind of name for C.boolean_t
could not determine kind of name for C.clear_last_error
could not determine kind of name for C.libzfs_errno
could not determine kind of name for C.libzfs_error_description
could not determine kind of name for C.libzfs_handle_ptr
could not determine kind of name for C.libzfs_init
# github.com/ncabatoff/go-libzfs
could not determine kind of name for C.boolean_t
could not determine kind of name for C.clear_last_error
could not determine kind of name for C.libzfs_errno
could not determine kind of name for C.libzfs_error_description
could not determine kind of name for C.libzfs_init
FAIL github.com/ncabatoff/go-libzfs [build failed]

I have a similar problem working with the bicomsystem's libzfs (which this repo is forked from)

Am I missing something big somewhere?

My system:
Fedora 24, kernel 4.10.11
go-1.6.4 (can't downgrade via package management system to 1.4, so probably not the way to go)
zfs-0.7.0-rc3 and libzfs2 installed and source dir linked to gopath

Thanks!
Michael

How do I install this?

I have promotheus node exporter installed on the latest proxmox already. How do I integrate this to my setup?

Documentation for state and status values

Hello,

first of all thanks for your awesome work, but I wonder where I can find the mapping between the integers of zpool state, status etc. and what they actually mean.

I found some prometheus description in the source code, but cannot really find it within prometheus.

Best

Support new zpool status: ZPOOL_STATUS_HOSTID_ACTIVE, ZPOOL_STATUS_HOSTID_REQUIRED and ZPOOL_STATUS_IO_FAILURE_MMP

Hi,

After upgarding zfs on a Linux system, we noticed that the ZPOOL_STATUS enum now contains 28 entry (0 to 27) instead of 25. (shifting the ZPOOL_STATUS_OK position from 24 to 27 in the process... triggering an alert in our Prometheus monitoring :-)

According to https://github.com/zfsonlinux/zfs/blob/master/include/libzfs.h, 3 new status were added:
ZPOOL_STATUS_HOSTID_ACTIVE, ZPOOL_STATUS_HOSTID_REQUIRED and ZPOOL_STATUS_IO_FAILURE_MMP.

For the record, here is the full list of values in zpool_status_t enum :

0 ZPOOL_STATUS_CORRUPT_CACHE, /* corrupt /kernel/drv/zpool.cache /
1 ZPOOL_STATUS_MISSING_DEV_R, /
missing device with replicas /
2 ZPOOL_STATUS_MISSING_DEV_NR, /
missing device with no replicas /
3 ZPOOL_STATUS_CORRUPT_LABEL_R, /
bad device label with replicas /
4 ZPOOL_STATUS_CORRUPT_LABEL_NR, /
bad device label with no replicas /
5 ZPOOL_STATUS_BAD_GUID_SUM, /
sum of device guids didn't match /
6 ZPOOL_STATUS_CORRUPT_POOL, /
pool metadata is corrupted /
7 ZPOOL_STATUS_CORRUPT_DATA, /
data errors in user (meta)data /
8 ZPOOL_STATUS_FAILING_DEV, /
device experiencing errors /
9 ZPOOL_STATUS_VERSION_NEWER, /
newer on-disk version /
10 ZPOOL_STATUS_HOSTID_MISMATCH, /
last accessed by another system /
11 ZPOOL_STATUS_HOSTID_ACTIVE, /
currently active on another system /
12 ZPOOL_STATUS_HOSTID_REQUIRED, /
multihost=on and hostid=0 /
13 ZPOOL_STATUS_IO_FAILURE_WAIT, /
failed I/O, failmode 'wait' /
14 ZPOOL_STATUS_IO_FAILURE_CONTINUE, /
failed I/O, failmode 'continue' /
15 ZPOOL_STATUS_IO_FAILURE_MMP, /
failed MMP, failmode not 'panic' /
16 ZPOOL_STATUS_BAD_LOG, /
cannot read log chain(s) /
17 ZPOOL_STATUS_ERRATA, /
informational errata available /
18 ZPOOL_STATUS_UNSUP_FEAT_READ, /
unsupported features for read /
19 ZPOOL_STATUS_UNSUP_FEAT_WRITE, /
unsupported features for write /
20 ZPOOL_STATUS_FAULTED_DEV_R, /
faulted device with replicas /
21 ZPOOL_STATUS_FAULTED_DEV_NR, /
faulted device with no replicas /
22 ZPOOL_STATUS_VERSION_OLDER, /
older legacy on-disk version /
23 ZPOOL_STATUS_FEAT_DISABLED, /
supported features are disabled /
24 ZPOOL_STATUS_RESILVERING, /
device being resilvered /
25 ZPOOL_STATUS_OFFLINE_DEV, /
device offline /
26 ZPOOL_STATUS_REMOVED_DEV, /
removed device */
27 ZPOOL_STATUS_OK

We are fine with the zfs-exporter code as it is because it return a numeric status sufficient for alerting but maybe updating the zfs_zpool_poolstatus metric help text would be a good idea :-)

Cheers

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.