ZFS – SNMP Extend Commands:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
#Zpool Usage extend .1.3.6.1.4.1.2021.88 zpool_name /bin/bash -c "sudo zpool list -H -o name" extend .1.3.6.1.4.1.2021.88 zpool_snap /bin/bash -c "sudo zpool list -Ho name|for strzpool in `xargs`;do sudo zfs get -rHp -o value usedbysnapshots $strzpool|awk -F: '{sum+=$1} END{print sum}';done" extend .1.3.6.1.4.1.2021.88 zpool_used /bin/bash -c "sudo zpool list -Ho name|xargs sudo zfs get -Hp -o value used" extend .1.3.6.1.4.1.2021.88 zpool_data_used /bin/bash -c "sudo zpool list -Ho name|for strzpool in `xargs`;do snap=`sudo zfs get -rHp -o value usedbysnapshots $strzpool|awk -F: '{sum+=$1} END{print sum}'`;pool=`sudo zfs get -Hp -o value used $zpool`; echo $pool $snap|awk '{print (\$1-\$2);}';done" extend .1.3.6.1.4.1.2021.88 zpool_available /bin/bash -c "sudo zpool list -Ho name|xargs sudo zfs get -Hp -o value available" extend .1.3.6.1.4.1.2021.88 zpool_capacity /bin/bash -c "sudo zpool list -H -o capacity" #ARC Usage extend .1.3.6.1.4.1.2021.85 arc_meta_max /bin/bash -c "sudo grep arc_meta_max /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'" extend .1.3.6.1.4.1.2021.85 arc_meta_used /bin/bash -c "sudo grep arc_meta_used /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'" extend .1.3.6.1.4.1.2021.85 arc_size /bin/bash -c "sudo grep -m 1 size /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'" extend .1.3.6.1.4.1.2021.85 arc_meta_limit /bin/bash -c "sudo grep arc_meta_limit /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'" extend .1.3.6.1.4.1.2021.85 arc_meta_c_max /bin/bash -c "sudo grep c_max /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'" #ARC Stats extend .1.3.6.1.4.1.2021.89 arc_hits /bin/bash -c "sudo grep -m 1 hits /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'" extend .1.3.6.1.4.1.2021.89 arc_misses /bin/bash -c "sudo grep misses /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'" #L2ARC Stats extend .1.3.6.1.4.1.2021.89 arc_l2_hits /bin/bash -c "sudo grep l2_hits /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'" extend .1.3.6.1.4.1.2021.89 arc_l2_misses /bin/bash -c "sudo grep l2_misses /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'" #VFS IOPS extend .1.3.6.1.4.1.2021.90 vopstats_zfs_nread /bin/bash -c "humnum=$(sudo zpool iostat | tail -n 1 | awk -F' ' '{print $4}') ; case ${humnum: -1:1} in [0-9]) echo $humnum | tr -d ' ' ;; 'K') bc -p ${humnum: 0:-1}*1024**1 | tr -d ' ' ;; 'M') bc -p ${humnum: 0:-1}*1024**2 | tr -d ' ' ;; 'G') bc -p ${humnum: 0:-1}*1024**3 | tr -d ' ' ;; 'T') bc -p ${humnum: 0:-1}*1024**4 | tr -d ' ' ;; 'P') bc -p ${humnum: 0:-1}*1024**5 ;; esac" extend .1.3.6.1.4.1.2021.90 vopstats_zfs_nwrite /bin/bash -c "humnum=$(sudo zpool iostat | tail -n 1 | awk -F' ' '{print $5}') ; case ${humnum: -1:1} in [0-9]) echo $humnum | tr -d ' ' ;; 'K') bc -p ${humnum: 0:-1}*1024**1 | tr -d ' ' ;; 'M') bc -p ${humnum: 0:-1}*1024**2 | tr -d ' ' ;; 'G') bc -p ${humnum: 0:-1}*1024**3 | tr -d ' ' ;; 'T') bc -p ${humnum: 0:-1}*1024**4 | tr -d ' ' ;; 'P') bc -p ${humnum: 0:-1}*1024**5 ;; esac" #VFS Throughput extend .1.3.6.1.4.1.2021.90 vopstats_zfs_read_bytes /bin/bash -c "humnum=$(sudo zpool iostat | tail -n 1 | awk -F' ' '{print $6}') ; case ${humnum: -1:1} in [0-9]) echo $humnum | tr -d ' ' ;; 'K') bc -p ${humnum: 0:-1}*1024**1 | tr -d ' ' ;; 'M') bc -p ${humnum: 0:-1}*1024**2 | tr -d ' ' ;; 'G') calc -p ${humnum: 0:-1}*1024**3 | tr -d ' ' ;; 'T') calc -p ${humnum: 0:-1}*1024**4 | tr -d ' ' ;; 'P') calc -p ${humnum: 0:-1}*1024**5 ;; esac" extend .1.3.6.1.4.1.2021.90 vopstats_zfs_write_bytes /bin/bash -c "humnum=$(sudo zpool iostat | tail -n 1 | awk -F' ' '{print $7}') ; case ${humnum: -1:1} in [0-9]) echo $humnum | tr -d ' ' ;; 'K') bc -p ${humnum: 0:-1}*1024**1 | tr -d ' ' ;; 'M') bc -p ${humnum: 0:-1}*1024**2 | tr -d ' ' ;; 'G') bc -p ${humnum: 0:-1}*1024**3 | tr -d ' ' ;; 'T') bc -p ${humnum: 0:-1}*1024**4 | tr -d ' ' ;; 'P') bc -p ${humnum: 0:-1}*1024**5 ;; esac" #DeDupe Ratio extend .1.3.6.1.4.1.2021.91 zfs_dedup_ratio /bin/bash -c "zpool list | grep vol | cut -d \" \" -f 13 | tr -cd '[:digit:]'" |
LibreNMS:
https://community.librenms.org/t/zfs-support/1839
https://docs.librenms.org/#Extensions/Applications/#zfs