Botica.Batteries.Disk (Botica v2.2.0)

Copy Markdown View Source

Predefined health check for disk space usage.

This module provides a check that monitors disk consumption and warns when available space falls below safe thresholds.

Uses Trebejo.Util.run_cmd_legacy/3 (via safe_run_cmd_legacy/3) with arg lists — never interpolated into shell strings — to prevent shell injection. The LC_ALL=C env var ensures locale-stable output.

Usage

config = %{
  app_name: "myapp",
  checks: [
    Botica.Batteries.Disk.check(path: "/", warning_threshold: 80, error_threshold: 95)
  ]
}

Options

  • :path - Path to check (default: "/")
  • :warning_threshold - Disk % to trigger warning (default: 80)
  • :error_threshold - Disk % to trigger error (default: 95)
  • :timeout - Check timeout in ms (default: 5000)

Summary

Functions

Checks disk space usage for a given path.

Functions

check_disk(path, warning_threshold, error_threshold)

Checks disk space usage for a given path.