Prototype: diskfree(path)

Return type: int

Descriptions: Return the free space (in KB) available on the current partition of path.

If path is not found, this function returns 0.

Arguments:

  • path: string - File system directory - in the range: "?(/.*)

Example:

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";
}

Output:

code
R: The filesystem has free space