Monday, April 7, 2014

Cacti Monitor Solaris ZFS

Reference: http://forums.cacti.net/viewtopic.php?f=12&t=47979

Get Dataquery and import it into Cacti: http://files.hypervisor.fr/scripts/cacti_data_query_zfs_-_zpool_usage.xml

Get SNMP query: http://files.hypervisor.fr/scripts/zpool_usage.xml , and copy it to /usr/share/cacti/resource/snmp_queries

Extend SNMP on Solaris
append below entries to /etc/net-snmp/snmp/snmpd.conf

extend .1.3.6.1.4.1.2021.88 zpool_name /bin/bash -c "zpool list -H -o name"
extend .1.3.6.1.4.1.2021.88 zpool_snap /bin/bash -c "zpool list -Ho name|for zpool in `xargs`;do zfs get -rHp -o value usedbysnapshots $zpool|awk -F: '{sum+=$1} END{print sum}';done"
extend .1.3.6.1.4.1.2021.88 zpool_used /bin/bash -c "zpool list -Ho name|xargs zfs get -Hp -o value used"
extend .1.3.6.1.4.1.2021.88 zpool_data_used /bin/bash -c "zpool list -Ho name|for zpool in `xargs`;do snap=`zfs get -rHp -o value usedbysnapshots $zpool|awk -F: '{sum+=$1} END{print sum}'`;pool=`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 "zpool list -Ho name|xargs zfs get -Hp -o value available"
extend .1.3.6.1.4.1.2021.88 zpool_capacity /bin/bash -c "zpool list -H -o capacity"


Restart SNMP,

# svcadm disable svc:/application/management/net-snmp:default
# svcadm enable svc:/application/management/net-snmp:default


No comments:

Post a Comment