diff --git a/cmd/api/main.go b/cmd/api/main.go
index 2f66829..f06760f 100644
--- a/cmd/api/main.go
+++ b/cmd/api/main.go
@@ -89,6 +89,7 @@ func run(log *slog.Logger, level *slog.LevelVar, args []string) error {
go srv.RunScheduler(ctx)
go srv.RunNotifier(ctx)
go srv.RunHousekeeping(ctx)
+ go srv.RunHeartbeats(ctx)
return platform.Serve(ctx, log, platform.NewHTTPServer(cfg.Listen, r), health, 5*time.Second, cfg.ShutdownTimeout)
}
diff --git a/internal/api/console.go b/internal/api/console.go
index 0242305..9f57f17 100644
--- a/internal/api/console.go
+++ b/internal/api/console.go
@@ -18,6 +18,7 @@ import (
"git.zb-server.de/ZB-Server/uptimesebi/internal/auth"
"git.zb-server.de/ZB-Server/uptimesebi/internal/authz"
"git.zb-server.de/ZB-Server/uptimesebi/internal/check"
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
"git.zb-server.de/ZB-Server/uptimesebi/internal/maintenance"
"git.zb-server.de/ZB-Server/uptimesebi/internal/store"
"git.zb-server.de/ZB-Server/uptimesebi/internal/web"
@@ -80,10 +81,12 @@ func (s *Server) dashboard(c *gin.Context) {
}
type monitorData struct {
- tree groupTree
- maint map[uuid.UUID][]store.MaintenanceWindow
- rows []web.MonitorRow
- byID map[uuid.UUID]store.Monitor
+ // heartbeatLabel names the pseudo-region of heartbeat results.
+ heartbeatLabel string
+ tree groupTree
+ maint map[uuid.UUID][]store.MaintenanceWindow
+ rows []web.MonitorRow
+ byID map[uuid.UUID]store.Monitor
// buckets cover the selected range at its resolution.
buckets map[uuid.UUID][]web.Bucket
down map[uuid.UUID][]web.Span
@@ -178,6 +181,7 @@ func (s *Server) loadMonitorData(ctx context.Context, p *principal, rng web.Time
d := monitorData{
byID: map[uuid.UUID]store.Monitor{}, down: map[uuid.UUID][]web.Span{},
regionOf: map[uuid.UUID]store.Region{}, rng: rng, now: now,
+ heartbeatLabel: i18n.T(ctx, "monitors.type_heartbeat"),
}
var (
monitors []store.Monitor
@@ -259,14 +263,19 @@ func (s *Server) loadMonitorData(ctx context.Context, p *principal, rng web.Time
}
d.byID[m.ID] = m
row := web.MonitorRow{ID: m.ID.String(), Name: m.Name, Type: m.Type, Target: m.Target, Latency: "–", Uptime: "–"}
+ keys := idStrings(regionsOf[m.ID])
+ if check.Passive(check.Type(m.Type)) {
+ // The target of a heartbeat is its secret ping token.
+ row.Target, keys = "", []string{heartbeatRegion}
+ }
if m.GroupID != nil {
row.GroupID = m.GroupID.String()
}
var latencies []int32
failing, reported := 0, 0
- for _, rid := range regionsOf[m.ID] {
- rs := web.RegionStatus{Name: d.regionName(rid), Status: web.StatusUnknown, Detail: "–"}
- if l, ok := latestOf[m.ID][rid.String()]; ok {
+ for _, key := range keys {
+ rs := web.RegionStatus{Name: d.regionNameString(key), Status: web.StatusUnknown, Detail: "–"}
+ if l, ok := latestOf[m.ID][key]; ok {
reported++
rs.Detail = l.Time.Format("15:04:05")
if l.Ok {
@@ -337,6 +346,7 @@ func (s *Server) monitorDetail(c *gin.Context, p *principal, page web.Page, me w
}
v := web.MonitorDetailView{
Interval: (time.Duration(m.IntervalSeconds) * time.Second).String(),
+ PingURL: s.detailPingURL(p, d, m),
CanWrite: canInGroup(p, authz.MonitorsWrite, d.tree, m.GroupID),
Latency: web.Latency(d.buckets[id], d.now.Add(-d.rng.Window).Truncate(d.rng.Bucket), d.now, 480, 96),
Maintenance: maintenanceItems(d.maint[id], d.now),
@@ -406,6 +416,9 @@ func (s *Server) monitorDetail(c *gin.Context, p *principal, page web.Page, me w
}
func (d monitorData) regionNameString(id string) string {
+ if id == heartbeatRegion {
+ return d.heartbeatLabel
+ }
if u, err := uuid.Parse(id); err == nil {
return d.regionName(u)
}
@@ -461,7 +474,7 @@ func (s *Server) monitorEditor(c *gin.Context, p *principal, page web.Page, me w
ctx := c.Request.Context()
f := web.MonitorForm{
Type: "http", IntervalSeconds: 60, TimeoutMS: 10000, Confirmations: 2, Enabled: true,
- MinInterval: s.minInterval(), Method: "GET", ExpectStatus: "2xx, 3xx",
+ MinInterval: s.minInterval(), Method: "GET", ExpectStatus: "2xx, 3xx", GraceSeconds: check.DefaultHeartbeatGrace,
FollowRedirects: true, VerifyTLS: true, DNSRecord: "A", TLSMinDays: 14,
}
var (
@@ -541,6 +554,11 @@ func fillForm(f *web.MonitorForm, m store.Monitor) {
var c check.TLSConfig
_ = json.Unmarshal(m.Config, &c)
f.TLSMinDays, f.TLSServerName = c.MinDaysValid, c.ServerName
+ case check.Heartbeat:
+ var c check.HeartbeatConfig
+ _ = json.Unmarshal(m.Config, &c)
+ f.GraceSeconds = c.GraceSeconds
+ f.Target = ""
}
}
@@ -860,3 +878,12 @@ func maintenanceItems(ws []store.MaintenanceWindow, now time.Time) []web.Mainten
}
return out
}
+
+// detailPingURL shows the ping URL of a heartbeat monitor to those who may
+// change the monitor; anyone holding it can report the job healthy.
+func (s *Server) detailPingURL(p *principal, d monitorData, m store.Monitor) string {
+ if !check.Passive(check.Type(m.Type)) || !canInGroup(p, authz.MonitorsWrite, d.tree, m.GroupID) {
+ return ""
+ }
+ return s.pingURL(m.Target)
+}
diff --git a/internal/api/heartbeat.go b/internal/api/heartbeat.go
new file mode 100644
index 0000000..a279515
--- /dev/null
+++ b/internal/api/heartbeat.go
@@ -0,0 +1,151 @@
+package api
+
+import (
+ "context"
+ "errors"
+ "io"
+ "net/http"
+ "strings"
+ "time"
+
+ "github.com/gin-gonic/gin"
+ "github.com/google/uuid"
+ "github.com/jackc/pgx/v5"
+
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/auth"
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/store"
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/tenant"
+)
+
+// heartbeatRegion is the region heartbeat results are filed under: pings
+// arrive from wherever the job runs, not from a checker region.
+const heartbeatRegion = "heartbeat"
+
+// newPingToken returns the secret that makes up a ping URL.
+func newPingToken() string { return auth.RandomToken() }
+
+func (s *Server) pingURL(token string) string {
+ return strings.TrimSuffix(s.cfg.PublicURL, "/") + "/hb/" + token
+}
+
+func (s *Server) mountHeartbeats(r gin.IRouter) {
+ methods := []string{http.MethodGet, http.MethodHead, http.MethodPost}
+ r.Match(methods, "/hb/:token", s.ping)
+ r.Match(methods, "/hb/:token/fail", s.ping)
+}
+
+// ping records a heartbeat. Jobs call it with curl or wget, so it takes
+// GET, HEAD and POST, needs no headers and answers in plain text. A path
+// ending in /fail reports a failure; a message may come as ?msg= or as the
+// POST body.
+func (s *Server) ping(c *gin.Context) {
+ token := c.Param("token")
+ ctx := c.Request.Context()
+ if !s.limit(c, "ping:"+token, 60, time.Minute) {
+ return
+ }
+ var m store.HeartbeatMonitorRow
+ err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
+ var err error
+ m, err = q.HeartbeatMonitor(ctx, token)
+ return err
+ })
+ if errors.Is(err, pgx.ErrNoRows) {
+ c.String(http.StatusNotFound, "unknown heartbeat\n")
+ return
+ }
+ if err != nil {
+ internalError(c, err)
+ return
+ }
+ if !m.Enabled {
+ c.String(http.StatusOK, "OK (paused)\n")
+ return
+ }
+ ok := !strings.HasSuffix(c.FullPath(), "/fail")
+ msg := c.Query("msg")
+ if msg == "" && c.Request.Method == http.MethodPost {
+ body, _ := io.ReadAll(io.LimitReader(c.Request.Body, 2000))
+ msg = strings.TrimSpace(string(body))
+ }
+ if !ok && msg == "" {
+ msg = "reported failure"
+ }
+ if err := s.recordHeartbeat(ctx, m.ID, m.OrgID, m.IntervalSeconds, m.Confirmations, ok, msg, time.Now()); err != nil {
+ internalError(c, err)
+ return
+ }
+ c.String(http.StatusOK, "OK\n")
+}
+
+// recordHeartbeat stores a ping or a missed deadline and evaluates it like
+// a checker result.
+func (s *Server) recordHeartbeat(ctx context.Context, id, org uuid.UUID, interval, confirmations int32, ok bool, msg string, at time.Time) error {
+ row := store.InsertCheckResultsParams{Time: at, OrgID: org, MonitorID: id, Region: heartbeatRegion, Ok: ok}
+ if msg != "" {
+ row.Error = ptr(truncateValid(msg, 500))
+ }
+ err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
+ _, err := q.InsertCheckResults(ctx, []store.InsertCheckResultsParams{row})
+ return err
+ })
+ if err != nil {
+ return err
+ }
+ s.evaluateResults(ctx, heartbeatRegion,
+ []agentapi.Result{{MonitorID: id, ScheduledAt: at, StartedAt: at, OK: ok}},
+ map[uuid.UUID]store.MonitorsForResultsRow{id: {
+ ID: id, OrgID: org, IntervalSeconds: interval, Confirmations: confirmations, Regions: []string{heartbeatRegion},
+ }})
+ return nil
+}
+
+// missedPing is the error recorded for an overdue heartbeat.
+const missedPing = "no ping received in time"
+
+// RunHeartbeats records a failure for every heartbeat monitor whose ping is
+// overdue, until ctx ends. Every replica runs it; a short Redis lock lets
+// one of them do each round.
+func (s *Server) RunHeartbeats(ctx context.Context) {
+ tick := time.NewTicker(10 * time.Second)
+ defer tick.Stop()
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case <-tick.C:
+ }
+ got, err := s.rdb.SetNX(ctx, "lock:heartbeats", 1, 9*time.Second).Result()
+ if err != nil || !got {
+ continue
+ }
+ if err := s.CheckHeartbeats(ctx, time.Now()); err != nil && ctx.Err() == nil {
+ s.log.ErrorContext(ctx, "checking heartbeats failed", "error", err)
+ }
+ }
+}
+
+// CheckHeartbeats records missed deadlines as of now. A recorded failure
+// restarts the wait, so a silent job fails once per interval plus grace.
+func (s *Server) CheckHeartbeats(ctx context.Context, now time.Time) error {
+ var due []store.HeartbeatsDueRow
+ err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
+ var err error
+ due, err = q.HeartbeatsDue(ctx)
+ return err
+ })
+ if err != nil {
+ return err
+ }
+ for _, m := range due {
+ deadline := m.WaitingSince.Add(time.Duration(m.IntervalSeconds+m.GraceSeconds) * time.Second)
+ if now.Before(deadline) {
+ continue
+ }
+ if err := s.recordHeartbeat(ctx, m.ID, m.OrgID, m.IntervalSeconds+m.GraceSeconds, m.Confirmations, false, missedPing, now); err != nil {
+ return err
+ }
+ }
+ return nil
+}
diff --git a/internal/api/heartbeat_test.go b/internal/api/heartbeat_test.go
new file mode 100644
index 0000000..1e593ad
--- /dev/null
+++ b/internal/api/heartbeat_test.go
@@ -0,0 +1,153 @@
+package api_test
+
+import (
+ "context"
+ "io"
+ "net/http"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/jackc/pgx/v5"
+)
+
+func TestHeartbeatMonitor(t *testing.T) {
+ e := newEnv(t)
+ owner := e.browser(t)
+ owner.signup("o@"+uniq("hb")+".test", uniq("hb-"))
+ st, body := owner.do("POST", "/api/v1/org/monitors", map[string]any{
+ "name": "Nightly backup", "type": "heartbeat", "interval_seconds": 3600, "config": map[string]any{"grace_seconds": 300},
+ })
+ if st != http.StatusCreated {
+ t.Fatalf("create heartbeat = %d %v", st, body)
+ }
+ id := body["id"].(string)
+ pingURL, _ := body["ping_url"].(string)
+ token := body["target"].(string)
+ if !strings.HasSuffix(pingURL, "/hb/"+token) || len(token) < 40 {
+ t.Fatalf("ping_url = %q, target = %q", pingURL, token)
+ }
+ path := "/hb/" + token
+ ping := func(method, suffix, payload string) (int, string) {
+ t.Helper()
+ req, _ := http.NewRequest(method, e.srv.URL+path+suffix, strings.NewReader(payload))
+ resp, err := e.srv.Client().Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+ b, _ := io.ReadAll(resp.Body)
+ return resp.StatusCode, string(b)
+ }
+ incidents := func() []any {
+ _, b := owner.do("GET", "/api/v1/org/incidents", nil)
+ return b["incidents"].([]any)
+ }
+ open := func() bool {
+ for _, i := range incidents() {
+ if i.(map[string]any)["resolved_at"] == nil {
+ return true
+ }
+ }
+ return false
+ }
+
+ if st, _ := ping("GET", "x", ""); st != http.StatusNotFound {
+ t.Errorf("unknown token = %d, want 404", st)
+ }
+
+ // Silence past interval plus grace is an outage.
+ ctx := context.Background()
+ waitingFor := func(d time.Duration) {
+ t.Helper()
+ err := e.asSystem(t, func(tx pgx.Tx) error {
+ _, err := tx.Exec(ctx, `UPDATE monitors SET updated_at = now() - $2::interval WHERE id = $1`, id, d)
+ return err
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ }
+ waitingFor(50 * time.Minute)
+ if err := e.api.CheckHeartbeats(ctx, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if open() {
+ t.Fatal("incident before the deadline")
+ }
+ waitingFor(66 * time.Minute)
+ if err := e.api.CheckHeartbeats(ctx, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if !open() {
+ t.Fatal("no incident after a missed ping")
+ }
+ // A failure restarts the wait instead of piling up.
+ if err := e.api.CheckHeartbeats(ctx, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if n := e.count(t, `SELECT count(*) FROM check_results WHERE monitor_id = $1 AND NOT ok`, id); n != 1 {
+ t.Errorf("failures recorded = %d, want 1", n)
+ }
+ // The next ping resolves it.
+ if st, out := ping("HEAD", "", ""); st != http.StatusOK {
+ t.Fatalf("ping = %d %q", st, out)
+ }
+ if open() {
+ t.Fatal("ping did not resolve the incident")
+ }
+ // A reported failure is an outage at once, with its message.
+ if st, _ := ping("POST", "/fail", "disk full"); st != http.StatusOK {
+ t.Fatalf("fail ping = %d", st)
+ }
+ if !open() {
+ t.Fatal("reported failure opened no incident")
+ }
+ _, list := owner.do("GET", "/api/v1/org/monitors", nil)
+ if !strings.Contains(mustJSON(list), "disk full") {
+ t.Error("failure message is not stored")
+ }
+ ping("POST", "", "")
+
+ // Editing keeps the URL; readers never see it.
+ st, body = owner.do("PUT", "/api/v1/org/monitors/"+id, map[string]any{
+ "name": "Nightly backup", "type": "heartbeat", "interval_seconds": 7200,
+ })
+ if st != http.StatusOK || body["target"] != token {
+ t.Errorf("edit = %d, target %v, want unchanged", st, body["target"])
+ }
+ viewer := e.joinVia(t, owner.invite("v@"+uniq("hb")+".test", owner.roleID("viewer")))
+ _, vl := viewer.do("GET", "/api/v1/org/monitors", nil)
+ if strings.Contains(mustJSON(vl), token) {
+ t.Error("a viewer sees the ping token")
+ }
+ for _, b := range []*browser{owner, viewer} {
+ _, _, html := b.page("/")
+ if strings.Contains(html, token) {
+ t.Error("the dashboard shows the ping token")
+ }
+ }
+ if _, _, html := owner.page("/monitors/" + id); !strings.Contains(html, pingURL) {
+ t.Error("the monitor page does not show the ping URL to its editor")
+ }
+ if _, _, html := viewer.page("/monitors/" + id); strings.Contains(html, token) {
+ t.Error("the monitor page shows the ping URL to a viewer")
+ }
+
+ // Other monitor types still need a target and regions.
+ st, body = owner.do("POST", "/api/v1/org/monitors", map[string]any{"name": "x", "type": "tcp", "target": "example.com:443", "interval_seconds": 60})
+ expect(t, "tcp without regions", st, body, http.StatusUnprocessableEntity, "invalid_region")
+
+ // Paused heartbeats accept pings but never fail.
+ owner.do("PUT", "/api/v1/org/monitors/"+id, map[string]any{"name": "Nightly backup", "type": "heartbeat", "interval_seconds": 7200, "enabled": false})
+ before := len(incidents())
+ if st, out := ping("GET", "", ""); st != http.StatusOK || !strings.Contains(out, "paused") {
+ t.Errorf("ping while paused = %d %q", st, out)
+ }
+ if err := e.api.CheckHeartbeats(ctx, time.Now().Add(48*time.Hour)); err != nil {
+ t.Fatal(err)
+ }
+ if len(incidents()) != before {
+ t.Error("a paused heartbeat failed")
+ }
+}
diff --git a/internal/api/monitors.go b/internal/api/monitors.go
index f76c2a9..ab2b92e 100644
--- a/internal/api/monitors.go
+++ b/internal/api/monitors.go
@@ -21,14 +21,16 @@ import (
)
type monitorRequest struct {
- Name string `json:"name" binding:"required,max=200"`
- Type string `json:"type" binding:"required"`
- Target string `json:"target" binding:"required,max=2000"`
+ Name string `json:"name" binding:"required,max=200"`
+ Type string `json:"type" binding:"required"`
+ // Target is ignored for heartbeat monitors, whose target is their
+ // generated ping token.
+ Target string `json:"target" binding:"max=2000"`
IntervalSeconds int `json:"interval_seconds" binding:"required"`
TimeoutMS int `json:"timeout_ms"`
Config json.RawMessage `json:"config"`
Enabled *bool `json:"enabled"`
- Regions []uuid.UUID `json:"regions" binding:"required,min=1,max=50"`
+ Regions []uuid.UUID `json:"regions" binding:"max=50"`
// Confirmations is how many failures in a row make a region count as
// down; 0 keeps the default of 2.
Confirmations int `json:"confirmations" binding:"min=0,max=10"`
@@ -58,6 +60,16 @@ type monitorView struct {
GroupID *uuid.UUID `json:"group_id"`
Regions []uuid.UUID `json:"regions"`
Latest []latestView `json:"latest"`
+ // PingURL is where heartbeat monitors are pinged.
+ PingURL string `json:"ping_url,omitempty"`
+}
+
+// withPingURL adds the ping URL of heartbeat monitors.
+func (s *Server) withPingURL(v monitorView) monitorView {
+ if check.Passive(check.Type(v.Type)) && v.Target != "" {
+ v.PingURL = s.pingURL(v.Target)
+ }
+ return v
}
func viewMonitor(m store.Monitor, regions []uuid.UUID) monitorView {
@@ -99,6 +111,21 @@ func (s *Server) validateMonitor(c *gin.Context, req *monitorRequest, t groupTre
fail(c, http.StatusUnprocessableEntity, "invalid_interval", "Min", s.minInterval())
return false
}
+ heartbeat := check.Passive(check.Type(req.Type))
+ if heartbeat {
+ // Pings arrive from one place, so one late ping is an outage, and
+ // there is neither a target nor a timeout to check against.
+ req.Target, req.Regions = "", nil
+ if req.Confirmations == 0 {
+ req.Confirmations = 1
+ }
+ if req.TimeoutMS == 0 {
+ req.TimeoutMS = 1000
+ }
+ } else if len(req.Regions) == 0 {
+ fail(c, http.StatusUnprocessableEntity, "invalid_region")
+ return false
+ }
if req.Confirmations == 0 {
req.Confirmations = 2
}
@@ -183,6 +210,11 @@ func (s *Server) listMonitors(c *gin.Context) {
continue
}
v := viewMonitor(m, byMonitor[m.ID])
+ if check.Passive(check.Type(m.Type)) && !canInGroup(p, authz.MonitorsWrite, t, m.GroupID) {
+ // Whoever knows the ping URL can report the job healthy.
+ v.Target = ""
+ }
+ v = s.withPingURL(v)
if l := latestBy[m.ID]; l != nil {
v.Latest = l
}
@@ -212,6 +244,9 @@ func (s *Server) createMonitor(c *gin.Context) {
if !s.validateMonitor(c, &req, t) {
return
}
+ if check.Passive(check.Type(req.Type)) {
+ req.Target = newPingToken()
+ }
var m store.Monitor
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
var err error
@@ -234,7 +269,7 @@ func (s *Server) createMonitor(c *gin.Context) {
internalError(c, err)
return
}
- c.JSON(http.StatusCreated, viewMonitor(m, req.Regions))
+ c.JSON(http.StatusCreated, s.withPingURL(viewMonitor(m, req.Regions)))
}
func setRegions(ctx context.Context, q *store.Queries, m store.Monitor, regions []uuid.UUID) error {
@@ -306,6 +341,13 @@ func (s *Server) updateMonitor(c *gin.Context) {
if previous, err = q.MonitorRegions(ctx, id); err != nil {
return err
}
+ if check.Passive(check.Type(req.Type)) {
+ // The ping URL stays the same across edits.
+ req.Target = old.Target
+ if old.Type != req.Type {
+ req.Target = newPingToken()
+ }
+ }
m, err = q.UpdateMonitor(ctx, store.UpdateMonitorParams{
ID: id, Name: req.Name, Type: req.Type, Target: req.Target,
IntervalSeconds: int32(req.IntervalSeconds), TimeoutMs: int32(req.TimeoutMS),
@@ -329,7 +371,7 @@ func (s *Server) updateMonitor(c *gin.Context) {
internalError(c, err)
return
}
- c.JSON(http.StatusOK, viewMonitor(m, req.Regions))
+ c.JSON(http.StatusOK, s.withPingURL(viewMonitor(m, req.Regions)))
}
func (s *Server) deleteMonitor(c *gin.Context) {
diff --git a/internal/api/server.go b/internal/api/server.go
index 6157882..94d397c 100644
--- a/internal/api/server.go
+++ b/internal/api/server.go
@@ -84,6 +84,7 @@ func (s *Server) Mount(r gin.IRouter) {
// Agents authenticate with tokens and never carry cookies, so they skip
// the session and CSRF middleware.
s.mountAgentAPI(r)
+ s.mountHeartbeats(r)
g := r.Group("/", s.sessions.Load(), s.localize(), auth.CSRF(), s.audit())
diff --git a/internal/check/check.go b/internal/check/check.go
index 0c02010..2e0a9f6 100644
--- a/internal/check/check.go
+++ b/internal/check/check.go
@@ -22,10 +22,16 @@ const (
ICMP Type = "icmp"
DNS Type = "dns"
TLS Type = "tls"
+ // Heartbeat monitors are pinged by the monitored job; no checker runs
+ // them.
+ Heartbeat Type = "heartbeat"
)
// Types lists every check type.
-var Types = []Type{HTTP, TCP, ICMP, DNS, TLS}
+var Types = []Type{HTTP, TCP, ICMP, DNS, TLS, Heartbeat}
+
+// Passive reports whether t is reported to us rather than run by checkers.
+func Passive(t Type) bool { return t == Heartbeat }
// Spec is everything needed to run one check.
type Spec struct {
@@ -77,6 +83,8 @@ var impls = map[Type]impl{
ICMP: icmpCheck{},
DNS: dnsCheck{},
TLS: tlsCheck{},
+
+ Heartbeat: heartbeatCheck{},
}
// Validate checks target and config for type t and returns the normalized
diff --git a/internal/check/heartbeat.go b/internal/check/heartbeat.go
new file mode 100644
index 0000000..6cb3c2e
--- /dev/null
+++ b/internal/check/heartbeat.go
@@ -0,0 +1,36 @@
+package check
+
+import (
+ "context"
+ "encoding/json"
+)
+
+// HeartbeatConfig configures a heartbeat monitor.
+type HeartbeatConfig struct {
+ // GraceSeconds is how late a ping may be before the monitor counts as
+ // failed, to absorb jobs that run a little longer than usual.
+ GraceSeconds int `json:"grace_seconds"`
+}
+
+// DefaultHeartbeatGrace applies when no grace period is set.
+const DefaultHeartbeatGrace = 60
+
+type heartbeatCheck struct{}
+
+func (heartbeatCheck) validate(_ string, config json.RawMessage) (json.RawMessage, error) {
+ c, err := decode[HeartbeatConfig](config)
+ if err != nil {
+ return nil, err
+ }
+ if c.GraceSeconds == 0 {
+ c.GraceSeconds = DefaultHeartbeatGrace
+ }
+ if c.GraceSeconds < 0 || c.GraceSeconds > 86400 {
+ return nil, invalid("invalid_grace")
+ }
+ return encode(c), nil
+}
+
+func (heartbeatCheck) run(context.Context, Spec) Outcome {
+ return Outcome{Error: "heartbeat monitors are not run by checkers"}
+}
diff --git a/internal/i18n/i18n_test.go b/internal/i18n/i18n_test.go
index 7d39996..897f174 100644
--- a/internal/i18n/i18n_test.go
+++ b/internal/i18n/i18n_test.go
@@ -151,7 +151,7 @@ func TestDynamicFamilies(t *testing.T) {
en := catalogKeys(t)["en"]
families := map[string][]string{
"status.": {"up", "degraded", "down", "unknown", "paused", "maintenance"},
- "monitors.type_": {"http", "tcp", "tls", "dns", "icmp"},
+ "monitors.type_": {"http", "tcp", "tls", "dns", "icmp", "heartbeat"},
"channels.type_": {"webhook", "email"},
"agents.kind_": {"checker", "statuspage"},
"page.status.": {"operational", "degraded", "outage", "unknown", "maintenance"},
diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json
index 4e49e4d..6ad351d 100644
--- a/internal/i18n/locales/de.json
+++ b/internal/i18n/locales/de.json
@@ -152,6 +152,7 @@
"error.invalid_domain": "Eine der Domains ist ungültig.",
"error.invalid_email": "Bitte eine gültige E-Mail-Adresse eingeben.",
"error.invalid_expect_status": "Erwartete Statuscodes müssen Codes wie 200 oder Klassen wie 2xx sein.",
+ "error.invalid_grace": "Die Toleranz muss zwischen 0 Sekunden und einem Tag liegen.",
"error.invalid_group": "Unbekannte Gruppe.",
"error.invalid_header": "Ein Request-Header ist ungültig.",
"error.invalid_input": "Eingaben prüfen.",
@@ -440,6 +441,9 @@
"monitors.edit": "Monitor bearbeiten",
"monitors.expect_status": "Erwarteter Status (z. B. 2xx, 301)",
"monitors.follow_redirects": "Weiterleitungen folgen",
+ "monitors.grace": "Toleranz (Sekunden)",
+ "monitors.grace_hint": "Wie spät ein Ping sein darf, für Jobs, die manchmal länger laufen.",
+ "monitors.heartbeat_hint": "Dein Job ruft bei jedem Lauf eine geheime URL auf. Kommt innerhalb von Intervall plus Toleranz kein Aufruf, gilt der Monitor als ausgefallen. Die URL wird nach dem Speichern angezeigt.",
"monitors.history": "Verlauf, letzte {{.Range}}",
"monitors.interval": "Intervall (Sekunden)",
"monitors.interval_hint": "Mindestens {{.Min}} Sekunden.",
@@ -449,6 +453,9 @@
"monitors.latency": "Durchschnittliche Latenz",
"monitors.method": "Methode",
"monitors.new": "Neuer Monitor",
+ "monitors.ping_intro": "Rufe diese URL am Ende jedes erfolgreichen Laufs auf, per GET, HEAD oder POST. Mit angehängtem /fail meldest du einen Fehler; ein POST-Body oder ?msg= wird als Meldung gespeichert.",
+ "monitors.ping_secret": "Halte die URL geheim: Wer sie kennt, kann den Job als gesund melden. Nur Mitglieder, die diesen Monitor bearbeiten dürfen, sehen sie.",
+ "monitors.ping_url": "Ping-URL",
"monitors.range": "Zeitraum",
"monitors.range_not_enough": "Für weniger als die Hälfte dieses Zeitraums liegen bisher Daten vor.",
"monitors.range_note": "SLA und Balken: letzte {{.Range}}",
@@ -464,6 +471,7 @@
"monitors.tls_server_name": "Servername (optional)",
"monitors.type": "Check-Typ",
"monitors.type_dns": "DNS",
+ "monitors.type_heartbeat": "Heartbeat",
"monitors.type_http": "HTTP(S)",
"monitors.type_icmp": "Ping (ICMP)",
"monitors.type_tcp": "TCP-Port",
diff --git a/internal/i18n/locales/en.json b/internal/i18n/locales/en.json
index 71becb9..7b2abc2 100644
--- a/internal/i18n/locales/en.json
+++ b/internal/i18n/locales/en.json
@@ -152,6 +152,7 @@
"error.invalid_domain": "One of the domains is not valid.",
"error.invalid_email": "Please enter a valid email address.",
"error.invalid_expect_status": "Expected status codes must be codes like 200 or classes like 2xx.",
+ "error.invalid_grace": "The grace period must be between 0 seconds and one day.",
"error.invalid_group": "Unknown group.",
"error.invalid_header": "A request header is not valid.",
"error.invalid_input": "Please check your input.",
@@ -440,6 +441,9 @@
"monitors.edit": "Edit monitor",
"monitors.expect_status": "Expected status (e.g. 2xx, 301)",
"monitors.follow_redirects": "Follow redirects",
+ "monitors.grace": "Grace period (seconds)",
+ "monitors.grace_hint": "How late a ping may be, for jobs that sometimes run longer.",
+ "monitors.heartbeat_hint": "Your job calls a secret URL each time it runs. If no call arrives within the interval plus the grace period, the monitor is down. The URL is shown after saving.",
"monitors.history": "History, last {{.Range}}",
"monitors.interval": "Interval (seconds)",
"monitors.interval_hint": "At least {{.Min}} seconds.",
@@ -449,6 +453,9 @@
"monitors.latency": "Average latency",
"monitors.method": "Method",
"monitors.new": "New monitor",
+ "monitors.ping_intro": "Call this URL at the end of every successful run, with GET, HEAD or POST. Append /fail to report a failure; a POST body or ?msg= is stored as the message.",
+ "monitors.ping_secret": "Keep the URL secret: anyone who knows it can report the job as healthy. Only members who may edit this monitor see it.",
+ "monitors.ping_url": "Ping URL",
"monitors.range": "Time range",
"monitors.range_not_enough": "Less than half of this period is covered by data yet.",
"monitors.range_note": "SLA and bars: last {{.Range}}",
@@ -464,6 +471,7 @@
"monitors.tls_server_name": "Server name (optional)",
"monitors.type": "Check type",
"monitors.type_dns": "DNS",
+ "monitors.type_heartbeat": "Heartbeat",
"monitors.type_http": "HTTP(S)",
"monitors.type_icmp": "Ping (ICMP)",
"monitors.type_tcp": "TCP port",
diff --git a/internal/web/assets/app.js b/internal/web/assets/app.js
index 8065a16..f228d8b 100644
--- a/internal/web/assets/app.js
+++ b/internal/web/assets/app.js
@@ -179,6 +179,17 @@
fs.hidden = !active;
fs.disabled = !active;
}
+ // [data-hide-for] holds fields a type does without, e.g. heartbeats
+ // have neither target nor regions.
+ for (const el of sel.form.querySelectorAll("[data-hide-for]")) {
+ const hide = el.dataset.hideFor.split(" ").includes(sel.value);
+ el.hidden = hide;
+ if (el.tagName === "FIELDSET") el.disabled = hide;
+ for (const input of el.querySelectorAll("input[required], input[data-required]")) {
+ input.required = !hide;
+ input.dataset.required = "";
+ }
+ }
});
document.addEventListener("change", async (ev) => {
diff --git a/internal/web/monitors.templ b/internal/web/monitors.templ
index 6a6c06b..3626795 100644
--- a/internal/web/monitors.templ
+++ b/internal/web/monitors.templ
@@ -246,6 +246,8 @@ type MonitorDetailView struct {
CanWrite bool
// Maintenance lists current and upcoming maintenance.
Maintenance []MaintenanceItem
+ // PingURL is set for heartbeat monitors the viewer may change.
+ PingURL string
}
// MaintenanceItem is one occurrence of planned maintenance.
@@ -265,7 +267,13 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {
@statusDot(v.Row.Status)
{ v.Row.Name }
-
{ v.Row.Type } · { v.Row.Target } · { v.Interval }
+
+ { i18n.T(ctx, "monitors.type_"+v.Row.Type) }
+ if v.Row.Target != "" {
+ { " · " + v.Row.Target }
+ }
+ { " · " + v.Interval }
+
if v.CanWrite {
{ i18n.T(ctx, "sso.action.edit") }
@@ -306,6 +314,9 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {
{ i18n.T(ctx, "monitors.by_region_hint") }
}
+ if v.PingURL != "" {
+ @pingSection(v.PingURL)
+ }
if len(v.Maintenance) > 0 {
@sectionHeading("maintenance.title")
@@ -447,6 +458,7 @@ type MonitorForm struct {
DNSExpect string
TLSMinDays int
TLSServerName string
+ GraceSeconds int
}
templ typeFields(typ, current string) {
@@ -504,13 +516,19 @@ templ MonitorEditor(p Page, me Me, f MonitorForm) {
- @valueField(i18n.T(ctx, "monitors.target"), "target", f.Target, "https://example.com", true)
- { i18n.T(ctx, "monitors.target_hint") }
+
+ @valueField(i18n.T(ctx, "monitors.target"), "target", f.Target, "https://example.com", f.Type != "heartbeat")
+
{ i18n.T(ctx, "monitors.target_hint") }
+
+ @typeFields("heartbeat", f.Type) {
+ { i18n.T(ctx, "monitors.heartbeat_hint") }
+ @numberField(i18n.T(ctx, "monitors.grace"), "config.grace_seconds", f.GraceSeconds, 0, 86400, i18n.T(ctx, "monitors.grace_hint"))
+ }
@typeFields("http", f.Type) {
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1378,20 +1392,20 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var66 string
templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(v.Uptime90)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 329, Col: 48}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 340, Col: 48}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1399,7 +1413,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1407,12 +1421,12 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, r := range v.Row.Regions {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "- ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "
- ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1420,43 +1434,43 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var67 string
templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 340, Col: 21}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 351, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var68 string
templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 341, Col: 77}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 352, Col: 77}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(v.Incidents) > 0 {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1468,12 +1482,12 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1481,84 +1495,84 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, r := range v.Recent {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "| ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, " |
| ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var69 string
templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(r.Time)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 359, Col: 86}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 370, Col: 86}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, " | ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var70 string
- templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(r.Region)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 360, Col: 41}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, " | ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+ var templ_7745c5c3_Var70 string
+ templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(r.Region)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 371, Col: 41}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, " | ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
if r.OK {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, "●")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, "●")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, "●")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, "●")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, " | ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, " | ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var71 string
templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(r.Latency)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 368, Col: 60}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 379, Col: 60}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, " | ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, " | ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var72 string
templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 369, Col: 65}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 380, Col: 65}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, " |
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1589,139 +1603,139 @@ func incidentList(rows []IncidentRow, showMonitor bool) templ.Component {
}
ctx = templ.InitializeContext(ctx)
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, r := range rows {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if r.Open {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var74 string
templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.ongoing"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 384, Col: 76}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 395, Col: 76}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 128, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 128, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 129, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var75 string
templ_7745c5c3_Var75, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.resolved"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 386, Col: 63}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 397, Col: 63}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var75))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 129, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if showMonitor {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, "\" class=\"hover:underline\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var77 string
templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 389, Col: 95}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 400, Col: 95}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 133, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 133, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 134, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var78 string
templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(r.Started)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 391, Col: 59}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 402, Col: 59}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 134, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 135, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var79 string
templ_7745c5c3_Var79, templ_7745c5c3_Err = templ.JoinStringErrs(r.Duration)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 392, Col: 57}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 403, Col: 57}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var79))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 135, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 136, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(r.Cause) > 0 {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 136, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 137, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var80 string
templ_7745c5c3_Var80, templ_7745c5c3_Err = templ.JoinStringErrs(strings.Join(r.Cause, " · "))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 395, Col: 81}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 406, Col: 81}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var80))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 137, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 138, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 138, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 140, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1763,20 +1777,20 @@ func IncidentsPage(p Page, me Me, rows []IncidentRow) templ.Component {
return templ_7745c5c3_Err
}
if len(rows) == 0 {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 140, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 141, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var83 string
templ_7745c5c3_Var83, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.none"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 406, Col: 103}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 417, Col: 103}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var83))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 141, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 142, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1833,6 +1847,7 @@ type MonitorForm struct {
DNSExpect string
TLSMinDays int
TLSServerName string
+ GraceSeconds int
}
func typeFields(typ, current string) templ.Component {
@@ -1853,36 +1868,36 @@ func typeFields(typ, current string) templ.Component {
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var84 := templ.GetChildren(ctx)
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 142, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 147, " class=\"mb-2\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1890,7 +1905,7 @@ func typeFields(typ, current string) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 147, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 148, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1915,95 +1930,95 @@ func numberField(label, name string, value, min, max int, hint string) templ.Com
}
ctx = templ.InitializeContext(ctx)
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 148, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2040,115 +2055,115 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 157, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 158, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if f.ID == "" {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 158, "← ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 159, "← ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var95 string
templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 480, Col: 93}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 492, Col: 93}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 159, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 160, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 160, "← ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 162, "\" class=\"text-muted hover:text-ink\">← ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var97 string
templ_7745c5c3_Var97, templ_7745c5c3_Err = templ.JoinStringErrs(f.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 482, Col: 97}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 494, Col: 97}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var97))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 162, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 163, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 163, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 164, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var98 string
templ_7745c5c3_Var98, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 485, Col: 65}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 497, Col: 65}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var98))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 164, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2716,7 +2814,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component {
}
ctx = templ.InitializeContext(ctx)
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Var126 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Var128 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
@@ -2733,12 +2831,12 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component {
return templ_7745c5c3_Err
}
if len(v.Channels) > 0 {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 217, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 229, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, ch := range v.Channels {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 218, "- ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 230, "
- ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2753,149 +2851,149 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 219, "")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var127 string
- templ_7745c5c3_Var127, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Name)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 615, Col: 21}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var127))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 220, " ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var128 string
- templ_7745c5c3_Var128, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.type_"+ch.Type))
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 616, Col: 70}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var128))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 221, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 231, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var129 string
- templ_7745c5c3_Var129, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Target)
+ templ_7745c5c3_Var129, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 617, Col: 77}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 635, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var129))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 222, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 232, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var130 string
+ templ_7745c5c3_Var130, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.type_"+ch.Type))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 636, Col: 70}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var130))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 233, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var131 string
+ templ_7745c5c3_Var131, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Target)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 637, Col: 77}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var131))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 234, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if v.CanWrite {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 223, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 230, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 242, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 231, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 243, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 232, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 244, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if v.CanWrite {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 233, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 245, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2903,7 +3001,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 234, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -2949,7 +3047,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component {
return templ_7745c5c3_Err
}
if v.EmailAvailable {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 238, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 261, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 250, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 262, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var141 string
- templ_7745c5c3_Var141, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.email_not_configured"))
+ var templ_7745c5c3_Var143 string
+ templ_7745c5c3_Var143, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.email_not_configured"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 666, Col: 79}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 686, Col: 79}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var141))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var143))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 251, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 263, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 252, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 264, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return nil
})
- templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var126), templ_7745c5c3_Buffer)
+ templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var128), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -3100,85 +3198,85 @@ func groupSelect(name string, groups []GroupOption, selected string, allowNone b
}
ctx = templ.InitializeContext(ctx)
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 253, "")
+ for _, g := range groups {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 269, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 274, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -3221,7 +3319,7 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component {
}
ctx = templ.InitializeContext(ctx)
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Var148 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Var150 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
@@ -3233,20 +3331,20 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 263, "← ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 275, "← ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var149 string
- templ_7745c5c3_Var149, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title"))
+ var templ_7745c5c3_Var151 string
+ templ_7745c5c3_Var151, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 705, Col: 115}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 725, Col: 115}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var149))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var151))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 264, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 276, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -3255,69 +3353,69 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component {
return templ_7745c5c3_Err
}
if len(v.Groups) > 0 {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 265, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 277, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, g := range v.Groups {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 266, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 279, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var151 string
- templ_7745c5c3_Var151, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name)
+ var templ_7745c5c3_Var153 string
+ templ_7745c5c3_Var153, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 712, Col: 21}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 732, Col: 21}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var151))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var153))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 268, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 280, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if g.CanWrite {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 269, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 281, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var152 string
- templ_7745c5c3_Var152, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit"))
+ var templ_7745c5c3_Var154 string
+ templ_7745c5c3_Var154, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 715, Col: 99}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 735, Col: 99}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var152))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var154))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 270, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 287, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 288, "\" data-confirm=\"")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var158 string
+ templ_7745c5c3_Var158, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "groups.delete_confirm")).Resolve(ctx)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 745, Col: 120}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var158)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 289, "\" class=\"mt-4 text-sm text-down hover:underline\">")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var159 string
+ templ_7745c5c3_Var159, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "groups.delete"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 745, Col: 200}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var159))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 290, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 279, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 291, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 280, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 292, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 281, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 293, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if v.CanWrite {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 282, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 294, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -3425,7 +3523,7 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 283, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 299, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return nil
})
- templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var148), templ_7745c5c3_Buffer)
+ templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var150), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -3488,4 +3586,85 @@ func partialTitle(ctx context.Context, partial bool) string {
return i18n.T(ctx, "monitors.range_not_enough")
}
+func pingSection(url string) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 300, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = sectionHeading("monitors.ping_url").Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 301, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var162 string
+ templ_7745c5c3_Var162, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_intro"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 780, Col: 83}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var162))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 302, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var163 string
+ templ_7745c5c3_Var163, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 " + url + "\n")
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 781, Col: 137}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var163))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var164 string
+ templ_7745c5c3_Var164, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 --data-raw \"$output\" " + url + "/fail")
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 781, Col: 208}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var164))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 303, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var165 string
+ templ_7745c5c3_Var165, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_secret"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 782, Col: 84}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var165))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 304, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
var _ = templruntime.GeneratedTemplate