v0.1.0

Alert Rules

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 round Previous count Action New count
Online Any None 0
Offline 0–3 None Previous + 1
Offline 4 Send alert 0

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

Alert Frequency

Situation Result
Site goes offline for 1–4 minutes, then recovers No email
Site stays offline One email at roughly minute 5, 10, 15, and so on
Manual refresh Counts as a round and speeds up accumulation

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

Alert Email

Field Value
Subject Website Offline Alert: <url>
Format HTML (Content-Type: text/html; charset=UTF-8)
Body URL, 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):

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

中文