feat(api): open incidents and notify channels when monitors go down
Results are evaluated as they arrive. Transitions open or resolve the monitor's incident and queue a notification per enabled channel in the same transaction; every API replica delivers the outbox with leases and exponential retries. Organizations manage webhook and email channels, can send test notifications and list incidents. Email requires UPTIME_SMTP_URL. Closes #14 Closes #15 Closes #16 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
01ef543e62
commit
5f42e3e650
12 files changed
+822
-13
No files matched your search
@@ -133,6 +133,18 @@ func TestEveryPermissionHasALabel(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Notification mails are looked up as "email.<event>.subject|body".
|
||||
func TestEveryMailEventHasTexts(t *testing.T) {
|
||||
en := catalogKeys(t)["en"]
|
||||
for _, ev := range []string{"opened", "resolved", "test"} {
|
||||
for _, part := range []string{"subject", "body"} {
|
||||
if id := "email." + ev + "." + part; !en[id] {
|
||||
t.Errorf("en.json is missing %q", id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The language switcher builds "lang.<code>" dynamically.
|
||||
func TestEveryLanguageHasAName(t *testing.T) {
|
||||
c, err := Load()
|
||||
|
||||
@@ -32,9 +32,18 @@
|
||||
"console.nav.tokens": "API-Tokens",
|
||||
"console.sso_required_action": "Mit SSO anmelden",
|
||||
"console.totp_missing_action": "Jetzt einrichten",
|
||||
"email.opened.body": "{{.Monitor}} ({{.Target}}) ist in allen Regionen nicht erreichbar seit {{.Since}}.\n\nLetzte Fehler:\n{{.Cause}}\n\nDu erhältst diese Nachricht, weil ein Benachrichtigungskanal deiner Organisation diese Adresse nutzt.",
|
||||
"email.opened.subject": "[DOWN] {{.Monitor}}",
|
||||
"email.resolved.body": "{{.Monitor}} ({{.Target}}) ist nach {{.Duration}} wieder erreichbar.",
|
||||
"email.resolved.subject": "[UP] {{.Monitor}}",
|
||||
"email.test.body": "Dies ist ein Test. Wenn du ihn lesen kannst, funktioniert der Kanal.",
|
||||
"email.test.subject": "Testbenachrichtigung von uptimesebi",
|
||||
"error.agent_protocol_unsupported": "Diese Agent-Version wird von der API nicht unterstützt. Bitte den Agent aktualisieren.",
|
||||
"error.already_assigned": "Das Mitglied hat diese Rolle bereits.",
|
||||
"error.already_member": "Diese Person ist bereits Mitglied.",
|
||||
"error.channel_test_failed": "Die Testbenachrichtigung konnte nicht zugestellt werden.",
|
||||
"error.channel_type_immutable": "Der Typ eines Kanals kann nicht geändert werden.",
|
||||
"error.email_not_configured": "E-Mail ist auf diesem Server nicht verfügbar.",
|
||||
"error.email_taken": "Diese E-Mail-Adresse ist bereits registriert.",
|
||||
"error.forbidden": "Dafür fehlt dir die Berechtigung.",
|
||||
"error.internal": "Interner Fehler.",
|
||||
@@ -56,6 +65,7 @@
|
||||
"error.invalid_target": "Das Ziel passt nicht zu diesem Check-Typ.",
|
||||
"error.invalid_timeout": "Der Timeout muss zwischen 100 ms und 60 s liegen und kürzer als das Intervall sein.",
|
||||
"error.invalid_type": "Unbekannter Check-Typ.",
|
||||
"error.invalid_webhook_url": "Die Webhook-URL muss eine https-URL ohne Zugangsdaten sein.",
|
||||
"error.invitation_email_mismatch": "Diese Einladung ging an eine andere E-Mail-Adresse als die, mit der du angemeldet bist.",
|
||||
"error.invitation_invalid": "Diese Einladung ist ungültig, abgelaufen oder wurde bereits verwendet.",
|
||||
"error.keyword_needs_get": "Keyword-Checks brauchen GET-Anfragen.",
|
||||
|
||||
@@ -32,9 +32,18 @@
|
||||
"console.nav.tokens": "API tokens",
|
||||
"console.sso_required_action": "Sign in with SSO",
|
||||
"console.totp_missing_action": "Set up now",
|
||||
"email.opened.body": "{{.Monitor}} ({{.Target}}) is down in all of its regions since {{.Since}}.\n\nLast errors:\n{{.Cause}}\n\nYou receive this because a notification channel of your organization is set up for this address.",
|
||||
"email.opened.subject": "[DOWN] {{.Monitor}}",
|
||||
"email.resolved.body": "{{.Monitor}} ({{.Target}}) is reachable again after {{.Duration}}.",
|
||||
"email.resolved.subject": "[UP] {{.Monitor}}",
|
||||
"email.test.body": "This is a test. If you can read it, the channel works.",
|
||||
"email.test.subject": "Test notification from uptimesebi",
|
||||
"error.agent_protocol_unsupported": "This agent version is not supported by the API. Please update the agent.",
|
||||
"error.already_assigned": "The member already has this role.",
|
||||
"error.already_member": "This person is already a member.",
|
||||
"error.channel_test_failed": "The test notification could not be delivered.",
|
||||
"error.channel_type_immutable": "The type of a channel cannot be changed.",
|
||||
"error.email_not_configured": "Email is not available on this server.",
|
||||
"error.email_taken": "This email address is already registered.",
|
||||
"error.forbidden": "You are not allowed to do this.",
|
||||
"error.internal": "Internal error.",
|
||||
@@ -56,6 +65,7 @@
|
||||
"error.invalid_target": "The target is not valid for this check type.",
|
||||
"error.invalid_timeout": "The timeout must be between 100 ms and 60 s and shorter than the interval.",
|
||||
"error.invalid_type": "Unknown check type.",
|
||||
"error.invalid_webhook_url": "The webhook URL must be an https URL without credentials.",
|
||||
"error.invitation_email_mismatch": "This invitation was sent to a different email address than the one you are signed in with.",
|
||||
"error.invitation_invalid": "This invitation is invalid, expired or was already used.",
|
||||
"error.keyword_needs_get": "Keyword checks need GET requests.",
|
||||
|
||||
Reference in new issue
Block a user