# `Monitorex.Alerts`

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

# `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`

Fire all notifiers for triggered alerts.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
