Check how much space (in KB) is available on a directory’s current partition.

body common control
{
      bundlesequence => { "example" };
}

bundle agent example
{
  classes:
      "has_space" expression => isgreaterthan($(free), 0);

  vars:
      "free" int => diskfree("/tmp");

  reports:
    has_space::
      "The filesystem has free space";
    !has_space::
      "The filesystem has NO free space";
}
R: The filesystem has free space

This policy can be found in
`/var/cfengine/share/doc/examples/diskfree.cf`
and downloaded directly from
<a href="https://raw.github.com/cfengine/core/master/examples/diskfree.cf" target="_blank">github</a>.

Example output:

```command
cf-agent -f unit_diskfree.cf
output
R: Freedisk 48694692
command
df -k /tmp
output
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda1      149911836 93602068  48694692  66% /