ZFS plugin reports wrong free space

The getzfs plugin calcluates wrong free space when used is more than quota0 bytes available .

RAW data from host:

OMD[site]:~$ telnet 656 
Connected to
Escape character is '^]'.
Version: 1.6.0p17
AgentOS: freebsd
Hostname: host.domain.ext
AgentDirectory: /etc/check_mk
PluginsDirectory: /usr/lib/check_mk_agent/plugins
LocalDirectory: /usr/lib/check_mk_agent/local
dataset13       name    dataset13       -
dataset13       quota   0       local
dataset13       used    33419296463072  -
dataset13       available       11861098415520  -
dataset13       mountpoint      /mnt/dataset13  default
dataset13       type    filesystem      -
dataset13/MyFolder      name    dataset13/MyFolder      -
dataset13/MyFolder      quota   5497558138880   local
dataset13/MyFolder      used    5497558146368   -
dataset13/MyFolder      available       0       -
dataset13/MyFolder      mountpoint      /mnt/dataset13/MyFolder default
dataset13/MyFolder      type    filesystem      -
dataset13                                                        11583104083         162 11583103921     0%    /mnt/dataset13
dataset13/MyFolder                                           5368709127  5368709127           0   100%    /mnt/dataset13/MyFolder

Output form the plugin:

OMD[site]:~$ cmk -nv --checks=zfsget
Check_MK version 1.6.0p18
 [agent] Execute data source
 [mgmt_ipmi] Execute data source
 [piggyback] Execute data source
No piggyback files for 'FN01'. Skip processing.
No piggyback files for ''. Skip processing.
Filesystem /mnt/dataset13 OK - 73.81% used (30.39 of 41.18 TB), (warn/crit at 95.67%/97.84%), trend: +12.45 MB / 24 hours
Filesystem /mnt/dataset13/MyFolder OK - 72.87% used (1.09 of 1.5 TB), (warn/crit at 100%/100%), trend: 0 B / 168 hours
OK - [agent] Version: 1.6.0p17, OS: freebsd, [mgmt_ipmi] Version: 2.72, execution time 4.2 sec | execution_time=4.191 user_time=0.270 system_time=0.030 children_user_time=0.000 children_system_time=0.000 cmk_time_agent=2.996

That is not good. My full 5TiB dataset is now suddenly just 1.5TB and has a lot of free space. I am quite sure the result is skewed because used is bigger than quota. However the plugin should be able to handle such an abnormality. Anyone around here that could help me fix the plugin?

I think the fault is within the def _parse_zfs(lines) line 91

        if entry["available"] != 0 and entry["type"] == "filesystem":

Yes, there is 0 bytes availible thus parsed does not contain my dataset anymore. Any thoughs why there is a filter for entry["available"] != 0 ?

You can copy the “zfsget” check file to “~/local/share/check_mk/checks/” and edit the “if” line to

If entry["type"] == "filesystem":

Only to try if your quota is found then.
In the end is the complete check a union from the “df” and “zfsget” data.
What you see in your case, is only the “df” part, as the zfs data is filtered as you said.

Thanx for your reply. If I change the if line the check works as expected.

Unfortunately not true. Somehow the plugin returns the zfs free/used of one of the other datasets if available is zero. Hence I still think this is a bug.

To investigate this a little bit more the complete section “zfsget” and “df” are needed as booth are used by this check.

1 Like

Hi Andreas,

The output contains names of my employer and his customers. I’ll send it private message to you.

edit: send!

Ok no problem :slight_smile:

Confirmed by @andreas-doehler in a private message :slight_smile:

So almost 3 months later; I still don’t see this fixed in the current 1.6.0p21 release. :pensive:

How can I help to get this fix released?

From the github page CONTRIBUTING.md:

We love to work with community contributors and want to make sure contributions and time investments are as effective as possible.