arnaudsj / monit

Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. (unofficial mirror)
http://mmonit.com/monit/
Other
515 stars 63 forks source link

ZFS SpaceUsage irritations #18

Open huehnerhose opened 5 years ago

huehnerhose commented 5 years ago

I am trying to set some alerts on zfs datasets / zfs pools and am puzzled about the given percentages.

[root@gorleben /usr/local/etc/monit.d] zfs list
NAME                 USED  AVAIL  REFER  MOUNTPOINT
zroot                202G   244G    88K  /zroot
zroot/pgsql          197G   244G   159G  /usr/local/pgsql

[root@gorleben /usr/local/etc/monit.d] zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
zroot   460G   202G   258G        -         -    70%    43%  1.00x  ONLINE  -

Monit config

check filesystem pgsql with path /usr/local/pgsql
  if space usage > 1% then exec "/usr/local/bin/monitbridge --level warning --debug"

monitbridge is my bridge to slack. The monit variable say:

MONIT_DESCRIPTION=space usage 39.5% matches resource limit [space usage > 1.0%] 

When I calculate usage based on the 197G shown by zfs list I expect ~42% and if I use the 202G used by the entire pool I expect ~44%.

So I looked further:

[root@gorleben /usr/local/etc/monit.d] df -h
Filesystem            Size    Used   Avail Capacity  Mounted on
zroot/pgsql           403G    159G    244G    40%    /usr/local/pgsql

Here we find the 39%. I got the strong feeling, monit should use the values reported by zfs list / zpool list rather than the df values.