Publish alerts to a Sandbar topic and keep a Sandbar monitor for every resource with health checks
A Sandbar topic channel publishes alerts as ntfy-style messages (API key optional). Under Server, Settings, Hammerhead can create, update and remove a Sandbar monitor per enabled resource with health checks, linked by resource id so monitors made by hand are left alone. The key is sealed at rest. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39659f0144
commit
654cf6d0fa
10 files changed
+810
-25
No files matched your search
+4
-1
@@ -26,6 +26,9 @@ func preview(ch AlertChannel) string {
|
||||
if ch.Kind == "email" {
|
||||
return ch.Target
|
||||
}
|
||||
if u, err := url.Parse(ch.Target); err == nil && ch.Kind == "topic" {
|
||||
return u.Scheme + "://" + u.Host + "/" + ch.Topic
|
||||
}
|
||||
if u, err := url.Parse(ch.Target); err == nil {
|
||||
return u.Scheme + "://" + u.Host + "/…"
|
||||
}
|
||||
@@ -95,7 +98,7 @@ func (s *Server) saveChannel(w http.ResponseWriter, r *http.Request, sc alertSco
|
||||
if in.Target == "" {
|
||||
in.Target = existing.Target // blank keeps the saved URL/address
|
||||
}
|
||||
if id != "" && in.Token == "" && in.Kind == "sandbar" {
|
||||
if id != "" && in.Token == "" && (in.Kind == "sandbar" || in.Kind == "topic") {
|
||||
in.Token = existing.Token // blank keeps the saved API key
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user