Check filesystem space
Table of contents
                    
                        
                    
                Check how much space (in KB) is available on a directory's current partition.
 code
      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";
}
 code
      R: The filesystem has free space
This policy can be found in
/var/cfengine/share/doc/examples/diskfree.cf
and downloaded directly from
github.
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% /