v0.1.0

Alert Rules

Last updated


This page explains when go-web-monitor sends an offline alert, how the failure count accumulates and resets, and what the alert email contains.

Failure Count


Each site has a count field in .webMonitor.json that records consecutive offline checks. After each round it updates as follows (internal/service/monitor.go:159):
Result this roundPrevious countActionNew count
OnlineAnyNone0
Offline0–3NonePrevious + 1
Offline4Send alert0

The condition is written as (count+1)%5 == 0; because the count resets on the 5th failure, the effective rule is "one email per 5 consecutive offline checks".
stateDiagram-v2
    [*] --> Healthy
    Healthy: Online (count = 0)
    Failing: Offline (count 1–4)
    Healthy --> Failing: Offline
    Failing --> Failing: Offline and count < 4
    Failing --> Healthy: Online
    Failing --> Alerted: 5th offline
    Alerted: Alert sent, count reset
    Alerted --> Failing: Still offline
    Alerted --> Healthy: Online
  1. stateDiagram-v2
  2. [*] --> Healthy
  3. Healthy: Online (count = 0)
  4. Failing: Offline (count 1–4)
  5. Healthy --> Failing: Offline
  6. Failing --> Failing: Offline and count < 4
  7. Failing --> Healthy: Online
  8. Failing --> Alerted: 5th offline
  9. Alerted: Alert sent, count reset
  10. Alerted --> Failing: Still offline
  11. Alerted --> Healthy: Online

Alert Frequency


SituationResult
Site goes offline for 1–4 minutes, then recoversNo email
Site stays offlineOne email at roughly minute 5, 10, 15, and so on
Manual refreshCounts as a round and speeds up accumulation

No "recovered" email is sent when a site comes back online.

Alert Email


FieldValue
SubjectWebsite Offline Alert: <url>
FormatHTML (Content-Type: text/html; charset=UTF-8)
BodyURL, Status: Offline, Reason: HTTP <code>, check time

On a connection failure the status code in Reason is HTTP 0.

Delivery Conditions


Alerts call SMTP.SendEmail() in a background goroutine. When any of the following is false, no email goes out and the error is written only to stderr (slog):
  • enabled is true
  • host is set
  • to has at least one recipient

See Email Alert Setup for configuration and SMTP Connection for connection details.
中文