Skip to content

Instantly share code, notes, and snippets.

@dashbad
Created June 30, 2016 00:34
Show Gist options
  • Save dashbad/6186f5ed31d9384dfbc272b5aa1d844a to your computer and use it in GitHub Desktop.
Save dashbad/6186f5ed31d9384dfbc272b5aa1d844a to your computer and use it in GitHub Desktop.
collectd exec script to collect zpool capacity information
#!/bin/bash
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
INTERVAL="${COLLECTD_INTERVAL:-60}"
while sleep "$INTERVAL"; do
VALUE="$(zpool list -Ho capacity)"
VALUE="$(echo "${VALUE: :-1}")"
echo "PUTVAL $HOSTNAME/zpool_capacity/percent interval=$INTERVAL N:$VALUE"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment