Monitorex.Alerts (monitorex v0.3.0)

Copy Markdown

Threshold-based alert evaluation for Monitorex.

Runs during the Collector cleanup cycle and fires notifiers when metrics exceed configured thresholds. Debounce prevents repeated alerts within a configurable min_interval.

Configuration

config :monitorex, :alerts, [
  %{
    name: "High error rate",
    metric: :error_rate,
    op: :gt,
    threshold: 0.05,
    window_seconds: 300,
    min_interval_seconds: 300,
    notifiers: [webhook: "https://hooks.example.com/alerts"]
  }
]

Supported metrics

  • :error_rate — host-level error rate (errors / requests, float 0.0–1.0)
  • :avg_latency_ms — host-level average latency in ms
  • :p99_latency_ms — host-level p99 latency in ms
  • :requests_per_min — host-level request rate
  • :host_down — no events from a host for window_seconds

Supported operators

  • :gt — greater than threshold
  • :lt — less than threshold

Summary

Functions

Evaluate all configured alerts against current ETS data.

Fire all notifiers for triggered alerts.

Functions

evaluate()

Evaluate all configured alerts against current ETS data.

Returns a list of triggered alert maps (or empty list). Only fires alerts that haven't fired within their min_interval_seconds.

fire_alerts(alerts)

Fire all notifiers for triggered alerts.