Adam - ZFS Pool Monitoring

New About Yours API Help
1.6 KB, HTML + Django/Jinja template
Hi,

I don't know if this is useful at all, but I've recently started using Ansible to gather information on my ZFS setup.

Some kind soul has written a module for Ansible to cover a lot of the ZFS stuff, meaning detailed output can be gathered with as few lines as the below:

Datasets:

---

- name: "Gather ZFS dataset data facts"
  zfs_facts:
    dataset: data

- name: Report space usage on ZFS filesystems under data
  zfs_facts:
    name: data
    recurse: yes
    type: filesystem

- debug:
    msg: 'ZFS dataset {{ item.name }} consumes {{ item.used }} of disk space.'
  with_items: '{{ ansible_zfs_datasets }}'

---

This is detailed very well on the Ansible pages: 

http://docs.ansible.com/ansible/latest/zfs_facts_module.html

There are also zpool options:

---

- name: Gather ZFS Pool Facts
  zpool_facts: 
    pool: zroot

- name: Gather space usage for all pools
  zpool_facts: 
    properties: 'free,size'

- name: Print gathered facts on size
  debug: 
    msg: 'ZFS pool {{ item.name }} has {{ item.free }} free space out of {{ item.size }}.'
  with_items: '{{ ansible_zfs_pools }}'

---

While not realtime monitoring, I find this very useful, and someone clearly had a desire at some point in the past for this functionality, as it's baked into Ansible.

Results look similar to: 

ok: [192.168.10.245] => (item={u'name': u'data', u'free': u'675G', u'size': u'928G'}) => {
    "item": {
        "free": "675G", 
        "name": "data", 
        "size": "928G"
    }, 
    "msg": "ZFS pool data has 675G free space out of 928G."
}
Pasted 11 months, 1 week ago — Expires in 27 days
URL: http://dpaste.com/3BQXXPM