diff --git a/.env.example b/.env.example
index fba5078..17e4ad5 100644
--- a/.env.example
+++ b/.env.example
@@ -27,6 +27,8 @@ UPTIME_TEST_REDIS_URL=redis://localhost:6379/15
# UPTIME_TEST_MYSQL_ADDR=localhost:13306
# UPTIME_TEST_MONGO_ADDR=localhost:27018
# UPTIME_TEST_MSSQL_ADDR=localhost:11433
+# UPTIME_TEST_RABBITMQ_ADDR=localhost:15672
+# UPTIME_TEST_KAFKA_ADDR=localhost:19092
# Reverse proxies allowed to set X-Forwarded-For (comma-separated IPs/CIDRs).
# UPTIME_TRUSTED_PROXIES=10.0.0.0/8
diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml
index f9bd87b..5bdddfd 100644
--- a/.gitea/workflows/ci.yaml
+++ b/.gitea/workflows/ci.yaml
@@ -68,11 +68,31 @@ jobs:
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: checkpw
+ rabbitmq:
+ image: rabbitmq:4-alpine
+ env:
+ RABBITMQ_DEFAULT_USER: check
+ RABBITMQ_DEFAULT_PASS: checkpw
+ kafka:
+ image: apache/kafka-native:4.1.1
+ env:
+ KAFKA_NODE_ID: 1
+ KAFKA_PROCESS_ROLES: broker,controller
+ KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
+ KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
+ KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
+ KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
+ KAFKA_CONTROLLER_QUORUM_VOTERS: 1@localhost:9093
+ KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
+ KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
+ KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
env:
UPTIME_TEST_DATABASE_URL: postgres://uptime:uptime@timescaledb:5432/uptime_test?sslmode=disable
UPTIME_TEST_REDIS_URL: redis://redis:6379/15
UPTIME_TEST_MYSQL_ADDR: mariadb:3306
UPTIME_TEST_MONGO_ADDR: mongo:27017
+ UPTIME_TEST_RABBITMQ_ADDR: rabbitmq:5672
+ UPTIME_TEST_KAFKA_ADDR: kafka:9092
steps:
- uses: actions/checkout@v7
# The runners are ephemeral and clone every action from GitHub, which
diff --git a/compose.yaml b/compose.yaml
index afef203..81d1200 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -82,5 +82,31 @@ services:
interval: 3s
retries: 60
+ rabbitmq:
+ image: rabbitmq:4-alpine
+ profiles: [checks]
+ environment: {RABBITMQ_DEFAULT_USER: check, RABBITMQ_DEFAULT_PASS: checkpw}
+ ports: ["15672:5672"]
+ healthcheck:
+ test: ["CMD", "rabbitmq-diagnostics", "-q", "check_port_connectivity"]
+ interval: 3s
+ retries: 60
+
+ kafka:
+ image: apache/kafka-native:4.1.1
+ profiles: [checks]
+ ports: ["19092:9092"]
+ environment:
+ KAFKA_NODE_ID: 1
+ KAFKA_PROCESS_ROLES: broker,controller
+ KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
+ KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:19092
+ KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
+ KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
+ KAFKA_CONTROLLER_QUORUM_VOTERS: 1@localhost:9093
+ KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
+ KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
+ KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
+
volumes:
pgdata:
diff --git a/internal/api/apidocs.go b/internal/api/apidocs.go
index a8724d6..45864bb 100644
--- a/internal/api/apidocs.go
+++ b/internal/api/apidocs.go
@@ -57,7 +57,7 @@ var endpoints = []endpoint{
description: "Only monitors the caller may read; header values and heartbeat tokens only for those who may change the monitor.",
perm: "monitors.read", resp: obj{"monitors": []monitorView{}}},
{method: "POST", path: "/api/v1/org/monitors", tag: "Monitors", summary: "Create a monitor",
- description: "`type` is one of http, json, prometheus, tcp, tls, dns, icmp, heartbeat or alertmanager; `config` depends on it (see HTTPConfig, JSONConfig, PrometheusConfig, DNSConfig, TLSConfig, HeartbeatConfig, AlertmanagerConfig). Heartbeat and alertmanager monitors take neither target nor regions; heartbeats return their `ping_url`.",
+ description: "`type` is one of http, json, prometheus, tcp, tls, dns, icmp, postgres, mysql, mssql, mongodb, redis, mqtt, kafka, rabbitmq, heartbeat or alertmanager (GET /api/v1/org/check-types lists those offered); `config` depends on it (see HTTPConfig, JSONConfig, PrometheusConfig, DNSConfig, TLSConfig, DBConfig, BrokerConfig, HeartbeatConfig, AlertmanagerConfig). Passwords are stored encrypted and never returned: `secrets_set` names those set, and an update that leaves one empty keeps it. Heartbeat and alertmanager monitors take neither target nor regions; heartbeats return their `ping_url`.",
perm: "monitors.write", req: monitorRequest{}, status: http.StatusCreated, resp: monitorView{}},
{method: "PUT", path: "/api/v1/org/monitors/:id", tag: "Monitors", summary: "Change a monitor", perm: "monitors.write",
req: monitorRequest{}, resp: monitorView{}},
diff --git a/internal/api/console.go b/internal/api/console.go
index 1ca5c1d..63ae514 100644
--- a/internal/api/console.go
+++ b/internal/api/console.go
@@ -625,6 +625,14 @@ func fillForm(f *web.MonitorForm, m store.Monitor) {
cfg, secrets := publicMonitorConfig(m.Config)
_ = json.Unmarshal(cfg, &c)
f.DB = web.DBForm{User: c.User, Database: c.Database, TLS: c.TLS, Query: c.Query, Expect: c.Expect, PasswordSet: slices.Contains(secrets, "password")}
+ case check.MQTT, check.Kafka, check.RabbitMQ:
+ var c check.BrokerConfig
+ cfg, secrets := publicMonitorConfig(m.Config)
+ _ = json.Unmarshal(cfg, &c)
+ f.Broker = web.BrokerForm{
+ User: c.User, TLS: c.TLS, Topic: c.Topic, Expect: c.Expect, Message: c.Message, SASL: c.SASL,
+ Vhost: c.Vhost, Queue: c.Queue, PasswordSet: slices.Contains(secrets, "password"),
+ }
case check.Alertmanager:
var c check.AlertmanagerConfig
_ = json.Unmarshal(m.Config, &c)
diff --git a/internal/api/openapi.go b/internal/api/openapi.go
index 9fd9be4..35d500e 100644
--- a/internal/api/openapi.go
+++ b/internal/api/openapi.go
@@ -236,7 +236,7 @@ func buildOpenAPI(publicURL string) map[string]any {
},
}
// Monitor settings travel as untyped config; their shapes per type.
- for _, c := range []any{check.HTTPConfig{}, check.JSONConfig{}, check.PrometheusConfig{}, check.DNSConfig{}, check.TLSConfig{}, check.HeartbeatConfig{}, check.AlertmanagerConfig{}} {
+ for _, c := range []any{check.HTTPConfig{}, check.JSONConfig{}, check.PrometheusConfig{}, check.DNSConfig{}, check.TLSConfig{}, check.DBConfig{}, check.BrokerConfig{}, check.HeartbeatConfig{}, check.AlertmanagerConfig{}} {
b.schema(reflect.TypeOf(c))
}
paths := map[string]map[string]any{}
diff --git a/internal/i18n/i18n_test.go b/internal/i18n/i18n_test.go
index 2b7c783..c9607fd 100644
--- a/internal/i18n/i18n_test.go
+++ b/internal/i18n/i18n_test.go
@@ -152,7 +152,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", "json", "prometheus", "postgres", "mysql", "mssql", "mongodb", "redis", "heartbeat", "alertmanager"},
+ "monitors.type_": {"http", "tcp", "tls", "dns", "icmp", "json", "prometheus", "postgres", "mysql", "mssql", "mongodb", "redis", "mqtt", "kafka", "rabbitmq", "heartbeat", "alertmanager"},
"channels.type_": {"webhook", "email", "slack", "discord", "teams", "googlechat", "mattermost", "rocketchat", "telegram", "matrix", "ntfy", "gotify", "pushover", "pushbullet", "signal", "pagerduty", "opsgenie", "apprise"},
"agents.kind_": {"checker", "statuspage"},
"page.status.": {"operational", "degraded", "outage", "unknown", "maintenance"},
@@ -164,6 +164,7 @@ func TestDynamicFamilies(t *testing.T) {
"evidence.phase_": {"dns", "connect", "tls", "wait", "download"},
"channels.field_": {"webhook_url", "channel", "bot_token", "chat_id", "thread_id", "api_url", "homeserver_url", "access_token", "room_id", "server_url", "topic", "priority", "app_token", "user_key", "device", "number", "recipients", "routing_key", "severity", "api_key", "region", "urls", "config_key"},
"monitors.db_database_": {"postgres", "mysql", "mssql", "mongodb", "redis"},
+ "monitors.broker_hint_": {"mqtt", "kafka", "rabbitmq"},
"monitors.db_tls_": {"require", "verify", "disable"},
"weekday.": {"0", "1", "2", "3", "4", "5", "6"},
"md.": {"heading", "bold", "italic", "strike", "link", "ul", "ol", "quote", "code", "codeblock", "table", "hr"},
diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json
index 9be4704..1d6c1b5 100644
--- a/internal/i18n/locales/de.json
+++ b/internal/i18n/locales/de.json
@@ -574,6 +574,17 @@
"monitors.assertion_value": "Wert",
"monitors.assertions": "Bedingungen",
"monitors.assertions_hint": "Alle müssen erfüllt sein. Pfade wie status.database oder checks[0].state; leere Zeilen werden ignoriert.",
+ "monitors.broker_expect": "Nachricht muss enthalten (optional)",
+ "monitors.broker_hint_kafka": "Ziel sind ein oder mehrere Broker als host:port. Fragt die Cluster-Metadaten ab; mit Topic muss es existieren und jede Partition einen Leader haben.",
+ "monitors.broker_hint_mqtt": "Ziel ist host:port (meist 1883, mit TLS 8883). Meldet sich an; mit Topic muss innerhalb des Timeouts eine Nachricht ankommen (Retained-Nachrichten zählen).",
+ "monitors.broker_hint_rabbitmq": "Ziel ist host:port des AMQP-Ports (meist 5672, mit TLS 5671). Meldet sich an und öffnet einen Kanal; mit Queue muss sie existieren.",
+ "monitors.broker_message": "Diese Nachricht ins Topic schreiben (optional)",
+ "monitors.broker_queue": "Queue (optional)",
+ "monitors.broker_sasl": "SASL-Verfahren (mit Benutzer)",
+ "monitors.broker_topic_kafka": "Topic (optional)",
+ "monitors.broker_topic_mqtt": "Topic (optional)",
+ "monitors.broker_user": "Benutzer (optional)",
+ "monitors.broker_vhost": "Virtueller Host",
"monitors.by_region": "Nach Region",
"monitors.by_region_hint": "Anteil erfolgreicher Checks aus jeder Region. Die SLA sinkt nur, wenn alle Regionen gleichzeitig ausfallen.",
"monitors.confirmations": "Fehlschläge bis zum Alarm",
@@ -650,7 +661,7 @@
"monitors.stale_hours": "Verfällt nach (Stunden)",
"monitors.stale_hours_hint": "Ein feuernder Alert, den Alertmanager nicht mehr wiederholt, gilt nach dieser Zeit als beendet. Halte sie über repeat_interval.",
"monitors.target": "Ziel",
- "monitors.target_hint": "URL für HTTP, host:port für TCP, TLS und Datenbanken, Hostname für DNS und ICMP.",
+ "monitors.target_hint": "URL für HTTP, host:port für TCP, TLS, Datenbanken und Broker (Kafka: mehrere, durch Komma getrennt), Hostname für DNS und ICMP.",
"monitors.timeout": "Timeout (ms)",
"monitors.tls_min_days": "Mindestens Tage bis Ablauf",
"monitors.tls_server_name": "Servername (optional)",
@@ -661,11 +672,14 @@
"monitors.type_http": "HTTP(S)",
"monitors.type_icmp": "Ping (ICMP)",
"monitors.type_json": "JSON-API",
+ "monitors.type_kafka": "Kafka",
"monitors.type_mongodb": "MongoDB",
+ "monitors.type_mqtt": "MQTT",
"monitors.type_mssql": "Microsoft SQL Server",
"monitors.type_mysql": "MySQL / MariaDB",
"monitors.type_postgres": "PostgreSQL",
"monitors.type_prometheus": "Prometheus",
+ "monitors.type_rabbitmq": "RabbitMQ",
"monitors.type_redis": "Redis",
"monitors.type_tcp": "TCP-Port",
"monitors.type_tls": "TLS-Zertifikat",
diff --git a/internal/i18n/locales/en.json b/internal/i18n/locales/en.json
index 1d0e8b4..f5bd404 100644
--- a/internal/i18n/locales/en.json
+++ b/internal/i18n/locales/en.json
@@ -574,6 +574,17 @@
"monitors.assertion_value": "Value",
"monitors.assertions": "Conditions",
"monitors.assertions_hint": "All must hold. Paths like status.database or checks[0].state; empty rows are ignored.",
+ "monitors.broker_expect": "Message must contain (optional)",
+ "monitors.broker_hint_kafka": "Target is one or more brokers as host:port. Fetches the cluster metadata; with a topic, it must exist and every partition must have a leader.",
+ "monitors.broker_hint_mqtt": "Target is host:port (usually 1883, 8883 with TLS). Signs in; with a topic, a message must arrive within the timeout (retained messages count).",
+ "monitors.broker_hint_rabbitmq": "Target is host:port of the AMQP port (usually 5672, 5671 with TLS). Signs in and opens a channel; with a queue, it must exist.",
+ "monitors.broker_message": "Produce this message to the topic (optional)",
+ "monitors.broker_queue": "Queue (optional)",
+ "monitors.broker_sasl": "SASL mechanism (with user)",
+ "monitors.broker_topic_kafka": "Topic (optional)",
+ "monitors.broker_topic_mqtt": "Topic (optional)",
+ "monitors.broker_user": "User (optional)",
+ "monitors.broker_vhost": "Virtual host",
"monitors.by_region": "By region",
"monitors.by_region_hint": "Share of successful checks from each region. The SLA only drops when all regions fail at the same time.",
"monitors.confirmations": "Failures before alerting",
@@ -650,7 +661,7 @@
"monitors.stale_hours": "Stale after (hours)",
"monitors.stale_hours_hint": "A firing alert Alertmanager stops repeating counts as over after this time. Keep it above repeat_interval.",
"monitors.target": "Target",
- "monitors.target_hint": "URL for HTTP, host:port for TCP, TLS and databases, host name for DNS and ICMP.",
+ "monitors.target_hint": "URL for HTTP, host:port for TCP, TLS, databases and brokers (Kafka: several, comma-separated), host name for DNS and ICMP.",
"monitors.timeout": "Timeout (ms)",
"monitors.tls_min_days": "Minimum days until expiry",
"monitors.tls_server_name": "Server name (optional)",
@@ -661,11 +672,14 @@
"monitors.type_http": "HTTP(S)",
"monitors.type_icmp": "Ping (ICMP)",
"monitors.type_json": "JSON API",
+ "monitors.type_kafka": "Kafka",
"monitors.type_mongodb": "MongoDB",
+ "monitors.type_mqtt": "MQTT",
"monitors.type_mssql": "Microsoft SQL Server",
"monitors.type_mysql": "MySQL / MariaDB",
"monitors.type_postgres": "PostgreSQL",
"monitors.type_prometheus": "Prometheus",
+ "monitors.type_rabbitmq": "RabbitMQ",
"monitors.type_redis": "Redis",
"monitors.type_tcp": "TCP port",
"monitors.type_tls": "TLS certificate",
diff --git a/internal/web/monitors.templ b/internal/web/monitors.templ
index 08b44f9..c6e4b1b 100644
--- a/internal/web/monitors.templ
+++ b/internal/web/monitors.templ
@@ -492,10 +492,17 @@ type MonitorForm struct {
Matchers []MatcherRow
StaleHours int
DB DBForm
+ Broker BrokerForm
// Types are the check types to offer.
Types []string
}
+// BrokerForm holds the settings of message broker checks.
+type BrokerForm struct {
+ User, TLS, Topic, Expect, Message, SASL, Vhost, Queue string
+ PasswordSet bool
+}
+
// DBForm holds the settings of database checks. The password is never
// filled in; PasswordSet tells the form one is stored.
type DBForm struct {
@@ -604,6 +611,11 @@ templ MonitorEditor(p Page, me Me, f MonitorForm) {
@dbFields(t, f.DB)
}
}
+ for _, t := range []string{"mqtt", "kafka", "rabbitmq"} {
+ @typeFields(t, f.Type) {
+ @brokerFields(t, f.Broker)
+ }
+ }
@typeFields("alertmanager", f.Type) {
{ i18n.T(ctx, "monitors.alertmanager_hint") }
@@ -1066,27 +1078,9 @@ templ dbFields(typ string, d DBForm) {
} else {
@valueField(i18n.T(ctx, "monitors.db_user_redis"), "config.user", d.User, "", false)
}
-
+ @secretField(i18n.T(ctx, "monitors.db_password"), "config.password", d.PasswordSet)
@valueField(i18n.T(ctx, "monitors.db_database_"+typ), "config.database", d.Database, "", false)
-
+ @tlsField(d.TLS, "require", "verify", "disable")
if typ != "redis" && typ != "mongodb" {
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -5316,4 +5252,307 @@ func dbFields(typ string, d DBForm) templ.Component {
})
}
+// secretField asks for a secret that is never shown again; left empty,
+// the stored one is kept.
+func secretField(label, name string, set bool) 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, 441, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var245 string
+ templ_7745c5c3_Var245, templ_7745c5c3_Err = templ.JoinStringErrs(label)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1097, Col: 90}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var245))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 442, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+// tlsField chooses a TLS mode; the first is preselected for new monitors.
+func tlsField(value string, modes ...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, 447, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var249 string
+ templ_7745c5c3_Var249, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.db_tls"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1113, Col: 115}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var249))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 448, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+func brokerFields(typ string, b BrokerForm) 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, 455, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var253 string
+ templ_7745c5c3_Var253, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.broker_hint_"+typ))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1123, Col: 78}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var253))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 456, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = valueField(i18n.T(ctx, "monitors.broker_user"), "config.user", b.User, "", false).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = secretField(i18n.T(ctx, "monitors.db_password"), "config.password", b.PasswordSet).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = tlsField(b.TLS, "disable", "require", "verify").Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ switch typ {
+ case "mqtt":
+ templ_7745c5c3_Err = valueField(i18n.T(ctx, "monitors.broker_topic_mqtt"), "config.topic", b.Topic, "devices/pump/status", false).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = valueField(i18n.T(ctx, "monitors.broker_expect"), "config.expect", b.Expect, "", false).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ case "kafka":
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 457, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var254 string
+ templ_7745c5c3_Var254, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.broker_sasl"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1133, Col: 122}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var254))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 458, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = valueField(i18n.T(ctx, "monitors.broker_topic_kafka"), "config.topic", b.Topic, "", false).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = valueField(i18n.T(ctx, "monitors.broker_message"), "config.message", b.Message, "", false).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ case "rabbitmq":
+ templ_7745c5c3_Err = valueField(i18n.T(ctx, "monitors.broker_vhost"), "config.vhost", b.Vhost, "/", false).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = valueField(i18n.T(ctx, "monitors.broker_queue"), "config.queue", b.Queue, "", false).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ return nil
+ })
+}
+
var _ = templruntime.GeneratedTemplate