Botica.Batteries.Memory (Botica v2.0.0)

Copy Markdown View Source

Predefined health check for system memory usage.

This module provides a check that monitors memory consumption and warns when it exceeds safe thresholds.

Uses Apero.OS.type/0 to dispatch directly between Linux (free) and macOS (vm_stat) instead of a blind fallback. All command execution is routed through Command.execute/2 so consumers get real timeout cancellation, telemetry, and structured errors.

Usage

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

Options

  • :warning_threshold - Memory % to trigger warning (default: 80)
  • :error_threshold - Memory % to trigger error (default: 95)
  • :timeout - Check timeout in ms (default: 5000)

Summary

Functions

Checks system memory usage. Dispatches Linux vs macOS via Apero.OS.type/0.

Functions

check_memory(warning_threshold, error_threshold)

Checks system memory usage. Dispatches Linux vs macOS via Apero.OS.type/0.