Table of Contents
Table of Contents
Table of Contents
Table of Contents
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
github.
Example output:
# cf-agent -f unit_diskfree.cf
R: Freedisk 48694692
# df -k /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 149911836 93602068 48694692 66% /
#