Skip to content

Alerts ​

Alerts tell a person that something needs them: a subscription ran out of quota, a budget is nearly used up, an account keeps failing, a protocol path was paused. They go to Slack, Discord, Telegram or your own signed webhook.

Alerts are built from events. Harbor Pilot records an event for every state change that matters, and an alert rule picks the events you care about and sends them to one or more channels.

Alerting never slows the gateway. Events are written in the same transaction as the change that caused them and delivered in the background, so a failing channel can't block a request.

Status

The Slack, Discord, Telegram and webhook adapters are contract-tested against local fakes of each service. They have not been run against the live services yet. See Compatibility.

Alerts has four tabs: Channels, Rules, History and Event relays (see Events).

Channels ​

Alerts page on the Channels tab, listing alert channels with where they send to, their delivery settings, an on/off switch, a Send test button and the rules that use themAlerts page on the Channels tab, listing alert channels with where they send to, their delivery settings, an on/off switch, a Send test button and the rules that use them
Alerts → Channels

Each channel shows where it Sends to, its Delivery settings, a Status switch (off shows Off — not sending), a Send test button and the rules that use it.

Add a channel ​

Alerts → Channels → Add channel, then answer Where should alerts go?

Add alert channel dialog with the channel type chosen, a name, the secret to store and the delivery settingsAdd alert channel dialog with the channel type chosen, a name, the secret to store and the delivery settings
A channel needs a name and one secret; the rest has defaults
TypeWhat you needNotes
SlackAn incoming webhook URL (Slack: Apps → Incoming Webhooks, starts with https://hooks.slack.com/services/)The URL is the secret.
DiscordA channel webhook URL (Channel settings → Integrations → Webhooks, starts with https://discord.com/api/webhooks/)The URL is the secret. Mentions are disabled, so an alert can't ping @everyone.
TelegramA bot token from @BotFather, and the Chat ID of the chat, group or channel (for example -1001234567890)The bot must be a member of the chat.
Signed webhookA Webhook URL and, optionally, a Signing secretEach alert is POSTed as JSON. See verifying signatures.

The secret is stored encrypted and never shown again. Instead of pasting it you can choose Use a secret kept on the server instead and name an environment variable or file, for example env:HP_SECRET_SLACK_WEBHOOK or file:/run/secrets/slack-webhook. Variables need an allowed prefix (by default HP_SECRET_).

A webhook URL must be a public HTTPS address. For a self-hosted receiver, tick Receiver is on a private network. The same applies to Telegram's API base URL override (only for a self-hosted Bot API server), with Relay is on a private network. That allows plain http and loopback or LAN addresses. Cloud metadata addresses stay blocked either way.

Send test sends one test message right away. Test messages can't be re-sent from History.

Delivery: quiet hours and noise control ​

Open Delivery in the channel dialog.

SettingWhat it does
Time zoneUsed for quiet hours and digests. Defaults to UTC.
Quiet hoursBetween Quiet from and Until, non-critical messages are held and sent as one digest when quiet hours end.
Critical messages still go outCritical alerts skip quiet hours.
Digest everyDuring quiet hours, send a digest this often (minutes). 0 sends one digest when quiet hours end.
At mostMessages per minute for this channel (default 20, 1–600). Extra messages wait for the next digest.

Slack, Discord and Telegram rate limits are respected: when a service answers "slow down", Harbor Pilot waits as long as it asks before retrying.

Rules ​

Add alert rule dialog with presets, an event picker, a severity choice, the channels to send to, and how often to repeatAdd alert rule dialog with presets, an event picker, a severity choice, the channels to send to, and how often to repeat
An alert rule: which events, how serious, where to, how often

Alerts → Rules → Add alert rule.

  1. Short name, and the Rule on switch.

  2. When: pick events. Start from offers presets:

    PresetEvents
    Quota used upQuota used up, Quota tracking cannot sign in
    Budget warningsBudget near its limit, Budget used up
    Account pausedAccount paused after errors
    Protocol path pausedProtocol path paused

    The Events picker groups every event kind by area (Quota, Budget, Provider accounts, Routing, Access, Protocol paths, Protocol changes, Routing plans, Configuration), each with an "any … event" choice. With no events picked, every event matches.

  3. How serious: Everything, Warnings and critical or Critical only. The dialog shows how many event kinds the rule matches.

  4. More conditions narrows the rule to one provider, account, client or other subject from the event.

  5. Send to: tick channels. A channel that is off is marked This channel is off, so nothing is sent through it.

  6. How often:

    • Repeat alerts for the same problem: Every time, At most every 15 minutes (default), every hour, every 6 hours, once a day, or Custom… (Wait at least N minutes).
    • Tell me when it recovers: also send a message when the problem clears, for example Quota available again or Protocol path restored.

Rules can't subscribe to alert or event-delivery events themselves (notification.*, event.*), so an alert can't trigger another alert.

Custom message and grouping ​

  • Group repeats for (minutes): after the first message, repeats of the same problem are counted and sent as one summary. 0 sends each one.

  • Message: an optional Go template, at most 2,000 characters. Empty sends every data field of the event.

    VariableMeaning
    {{.Name}}Event name, for example quota.window.exhausted
    {{.Severity}}info, warning or critical
    {{.Kind}}alert, recovery, digest or test
    {{.OccurredAt}}When the event happened
    {{.Subjects.provider_id}}An identity from the event's subjects
    {{.Data.reason}}A field from the event's data (see the event catalog)
    {{.Data.label | upper}}upper is the only helper function

History ​

Alerts → History lists every message: what was sent, to which Channel, its Status and When. Filter by channel and status.

Alerts, History tab: four messages sent to on-call-webhook, a breaker-opened warning, two test messages and the recovered message when the breaker closed, with channel and status filtersAlerts, History tab: four messages sent to on-call-webhook, a breaker-opened warning, two test messages and the recovered message when the breaker closed, with channel and status filters
Alert history: alerts, recoveries and test messages
StatusMeaning
WaitingQueued or being retried.
Held for digestHeld by quiet hours or the rate limit.
Sent in a digestDelivered as part of a digest.
SentDelivered.
FailedGave up after its retries. The line says how many attempts were made.

A failed message can be sent again (Send again). It goes back into the queue and is retried like a new message.

With Terraform ​

hcl
resource "harborpilot_notification_channel" "ops" {
  name = "ops-telegram"
  spec = jsonencode({
    type             = "telegram"
    telegram_chat_id = "-1001234567890"
    secret_ref       = "env:HP_SECRET_TELEGRAM_BOT_TOKEN"
    quiet_hours      = { enabled = true, start = "22:00", end = "07:00", critical_bypass = true }
    timezone         = "Europe/Vilnius"
    enabled          = true
  })
}

resource "harborpilot_notification_rule" "quota" {
  name = "quota-alerts"
  spec = jsonencode({
    channel_ids      = [harborpilot_notification_channel.ops.id]
    filter           = { events = ["quota.*", "budget.*"], min_severity = "warning" }
    cooldown_seconds = 1800
    recovery         = true
    enabled          = true
  })
}

See Terraform and the provider's 06-pulse-events-notifications example.

  • Events: the event stream, Pulse and signed webhooks.
  • Event catalog: every event kind and its data.
  • Limits: the quotas and budgets most alerts are about.

Released under the Apache-2.0 License.