Introducing a new way to review your PRs.

Read the announcement

rajnandan1 / kener

Stunning status pages, batteries included!

View on GitHub

19 documents · Updated Nov 23, 2026

docs / monitor-execution

Monitor execution and service checks

Monitor execution turns each active monitor configuration into a time-stamped result. A scheduler starts the configured check, a type-specific service tests the target, and status rules prepare the result for storage, alerts, badges, and history. For the wider system model, see Monitoring platform; stored samples are described in Monitoring history.

Execution lifecycle

The execution lifecycle is a scheduled queue flow. It keeps schedule management separate from the check itself, so a check can run in a worker and then pass one final result to storage and alert evaluation.

flowchart LR
    A[Active monitor and cron] --> B[Schedule worker]
    B --> C[Minute timestamp]
    C --> D[Execution queue]
    D --> E[Type dispatcher]
    E --> F[Service check]
    F --> G[Raw result]
    G --> H[Confirmation and status overlays]
    H --> I[Response queue]
    I --> J[Monitoring data]
    J --> K[Last status cache]
    J --> L[Alert evaluation]

The application scheduler refreshes monitor schedules about every ten seconds. Each active monitor with a cron expression gets a repeating schedule, while schedules for inactive or removed monitors are removed. A schedule starts immediately when it is created, then calls the minute dispatcher. src/…/appScheduler.ts• L25-76 src/…/monitorSchedulers.ts• L19-70

The minute dispatcher checks the monitor type and uses the UTC start of the current minute as the sample timestamp. It adds a short delay for group monitors so member results have time to update. The execution and response queues de-duplicate jobs by monitor tag and timestamp. This prevents repeated work and repeated writes for the same minute. src/…/cron-minute.ts• L15-27 src/…/monitorExecuteQueue.ts• L254-280 src/…/monitorResponseQueue.ts• L30-60

After the type check returns, the execution worker applies the monitor's default status and any active incident or maintenance status. It then sends the final result to the response queue. The response worker writes the sample, updates the last-status cache, and starts alert evaluation. Background queue work uses its worker database context rather than the web-request pool. src/…/monitorExecuteQueue.ts• L123-243 src/…/monitorResponseQueue.ts• L30-60 src/…/q.ts• L44-51

References: src/…/appScheduler.ts• L25-76 src/…/monitorSchedulers.ts• L19-70 src/…/cron-minute.ts• L15-27 src/…/monitorExecuteQueue.ts• L123-243 src/…/monitorResponseQueue.ts• L30-60 src/…/q.ts• L44-51

Monitor type checks

The dispatcher maps the configured monitor_type to one service check. Each check returns a status, latency, and result type. A check can also return an error message that explains why the status is not healthy.

Monitor typeWhat the check evaluatesNormal result rule
APIAn HTTP request and its responseSuccessful HTTP responses use UP by default. A configured evaluator can use the status code, response time, or body.
TCPA TCP connection to each configured host and portUP only when all connections are open.
SSLA TLS connection and the peer certificateRemaining certificate hours map to UP, DEGRADED, or DOWN. Connection and certificate errors are DOWN.
SQLA query against the configured database connectionA completed query is UP; query, connection, and timeout errors are DOWN.
PingICMP reachability and latency for each configured hostUP only when all hosts reply.
DNSA DNS record lookup and its expected valuesALL requires every expected value; ANY requires at least one expected value. A missing record or mismatch is DOWN.
gRPCThe standard gRPC health Check callSERVING is UP, NOT_SERVING is DOWN, and other reported health states are DEGRADED.
PrometheusA PromQL instant query against a Prometheus APIA matching DOWN threshold wins. A matching DEGRADED threshold follows. Other values are UP. Empty results and query failures use separate configured statuses.
DockerDocker daemon reachability or a container state and health checkA responding daemon is UP. A running container is UP unless it is restarting or its health check is starting or unhealthy.
HeartbeatThe age of the most recent accepted heartbeat signalNo signal is NO_DATA; signal age maps to UP, DEGRADED, or DOWN by the configured minute limits.
GroupThe latest status of member monitorsMember weights produce a combined status: all healthy is UP, partial health is DEGRADED, and no health is DOWN.
GameA query to the configured game serverA successful query is passed to the built-in or configured evaluator; query failures are DOWN.
No-op (NONE)No external targetIt returns a prior manual status only when configured to do so; otherwise it produces no monitoring result.

The dispatcher maps the supported types to dedicated checks, while an unmatched value falls through to the no-op service. The minute dispatcher rejects a type that is not in the supported monitor type list before it reaches that fallback. This keeps invalid scheduled configuration from silently becoming a no-op. src/…/monitor.ts• L7-22 src/…/cron-minute.ts• L15-18 src/…/service.ts• L47-90

Each service reports a result instead of throwing for common configuration and target failures. API and Prometheus checks also use configured error or no-data statuses where applicable. The queue treats completed checks, timeouts, and errors as result types that can take part in confirmation. src/…/service.ts• L47-90 src/…/prometheusCall.ts• L63-75 src/…/prometheusCall.ts• L107-195 src/…/monitorExecuteQueue.ts• L142-147

Target checks

API, TCP, ping, DNS, SSL, SQL, gRPC, game, Prometheus, and Docker monitors actively contact a target during execution. The check measures response time where the protocol supports it, then applies either a built-in rule or the monitor's configured evaluation rule. Invalid evaluation output is treated as a failed check rather than a healthy result. Missing API configuration, missing ping or TCP hosts, target errors, and evaluator errors return explicit ERROR results; an API timeout changes the result type to TIMEOUT. src/…/apiCall.ts• L26-35 src/…/apiCall.ts• L97-160 src/…/pingCall.ts• L18-26 src/…/pingCall.ts• L39-55 src/…/tcpCall.ts• L19-31 src/…/tcpCall.ts• L44-63 src/…/gamedigCall.ts• L22-62 src/…/dockerCall.ts• L27-72

Configured evaluators run in a separate, short-lived sandbox. The sandbox gives the evaluator its arguments and supported helper modules. It limits run time, memory, message size, and concurrent evaluations. It accepts only a known status and an optional numeric latency. This keeps custom monitor rules from blocking the monitor worker or returning an unusable result. src/…/evalSandbox.ts• L6-11 src/…/evalSandbox.ts• L136-177 src/…/evalSandbox.ts• L184-221

DNS checks can use normal DNS or DNS-over-TLS transport. SSL checks turn certificate time into service health, so a reachable endpoint can become DEGRADED or DOWN before expiry. A certificate that fails trust checks is DOWN unless the monitor allows untrusted certificates; that option affects the health result but the status page still marks the certificate as insecure. SQL checks treat a successful query as the health signal, not only a successful connection. src/…/dnsCall.ts• L28-117 src/…/sslCall.ts• L44-84 src/…/sqlCall.ts• L16-96

Prometheus checks send an instant query to the Prometheus query API and support scalar results or instant vectors. An empty vector or a NaN sample is valid no data and uses noDataStatus. Transport failures, non-success HTTP responses, and malformed success payloads use errorStatus. A DOWN threshold is checked before a DEGRADED threshold, and a value that matches neither is UP. src/…/prometheusCall.ts• L63-75 src/…/prometheusCall.ts• L107-195

Docker checks have two modes. Daemon mode confirms that the Docker Engine answers its ping request. Container mode resolves one configured container name or ID on every check and maps restarting or starting health checks to DEGRADED, while paused, stopped, or unhealthy containers are DOWN; a running container without an unhealthy state is UP. A missing container remains DOWN with an error that distinguishes it from a dead daemon. src/…/dockerCall.ts• L27-77 src/…/dockerCall.ts• L90-119 src/…/monitor-docker.svelte• L187-216

References: src/…/apiCall.ts• L26-35 src/…/apiCall.ts• L97-160 src/…/pingCall.ts• L18-55 src/…/tcpCall.ts• L19-63 src/…/gamedigCall.ts• L22-62 src/…/dnsCall.ts• L28-117 src/…/sslCall.ts• L44-84 src/…/sqlCall.ts• L16-96 src/…/prometheusCall.ts• L63-75 src/…/prometheusCall.ts• L107-195 src/…/dockerCall.ts• L27-119 src/…/evalSandbox.ts• L6-11 src/…/evalSandbox.ts• L136-221 src/…/monitor-docker.svelte• L164-216

Signal and composite monitors

Heartbeat monitors do not create the health signal themselves. An external job sends an authenticated request to the heartbeat endpoint, and the monitor later compares the last signal time with its age limits. The latest signal is read from cache first and from stored signal data after a cache miss, so a restart can recover the health view. src/…/+server.ts• L4-20 src/…/monitorsController.ts• L332-382 src/…/heartbeatCall.ts• L19-68

Group monitors use the latest stored or cached result for each member. They combine member health with configured weights and calculate group latency with an average, maximum, or minimum rule. A member in maintenance contributes as healthy to the group score. src/…/groupCall.ts• L35-91

No-op monitors provide a way to show a manually controlled status without running a target check. When enabled, they use only the latest manual result; when no such result exists, the execution worker has no result to store for that run. src/…/noneCall.ts• L5-31

References: src/…/+server.ts• L4-20 src/…/monitorsController.ts• L332-382 src/…/heartbeatCall.ts• L19-68 src/…/groupCall.ts• L35-91 src/…/noneCall.ts• L5-31

Monitor configuration

The monitor settings flow lets an operator select a monitor type, edit its type-specific settings, save the configuration, and run an immediate test. The type list and execution dispatcher must agree so that a setting that can be saved also has a matching check. The general settings also control the cron schedule, default status, hidden status-page visibility, and confirmation threshold. src/…/MonitorTypeCard.svelte• L108-132 src/…/MonitorTypeCard.svelte• L353-515 src/…/GeneralSettingsCard.svelte• L220-293

The API editor supports request methods, headers, bodies, timeouts, proxies, self-signed certificates, redirects, and custom evaluation. It warns when a secret reference would travel over plain HTTP in the URL, request body, headers, or proxy credentials. src/…/monitor-api.svelte• L19-48 src/…/monitor-api.svelte• L118-165

The Prometheus editor supports an instant query, optional DOWN and DEGRADED thresholds, separate statuses for no data and an unusable response, request headers, a timeout, a proxy, and self-signed certificate access. The editor warns when secret references would travel over plain HTTP in the target URL or proxy credentials; a secret used only in the PromQL query does not trigger that transport warning. src/…/monitor-prometheus.svelte• L14-47 src/…/monitor-prometheus.svelte• L62-221

The SSL editor exposes certificate expiry limits, TLS timeout, optional SNI, and the trust override. A zero-hour DOWN limit is valid and remains zero when an existing monitor is reopened. src/…/monitor-ssl.svelte• L10-17 src/…/monitor-ssl.svelte• L32-100 src/…/monitor-ssl.svelte.test.ts• L6-24

The Docker editor supports a Unix socket, plain TCP, or TLS connection to the daemon. The operator can check the daemon itself or a named container, and can browse containers before saving by using the current connection fields. New monitors use the configured connection default, while saved monitors keep their stored connection. Leaving TLS clears its certificate and key fields so old client credentials are not saved with a new connection mode. src/…/monitor-docker.svelte• L24-89 src/…/monitor-docker.svelte• L164-216 src/…/monitor-docker.svelte.test.ts• L7-95

References: src/…/MonitorTypeCard.svelte• L108-132 src/…/MonitorTypeCard.svelte• L353-515 src/…/GeneralSettingsCard.svelte• L220-293 src/…/monitor-api.svelte• L19-165 src/…/monitor-prometheus.svelte• L14-221 src/…/monitor-ssl.svelte• L10-100 src/…/monitor-docker.svelte• L24-216 src/…/monitor-docker.svelte.test.ts• L7-95

Status confirmation

Status confirmation is a damping rule for scheduled checks. It prevents one opposite observation from immediately changing the displayed side when a monitor has a confirmation threshold greater than one.

The rule reduces statuses to two sides for confirmation: UP is healthy, while DOWN and DEGRADED are unhealthy. NO_DATA is neutral. When a new observation changes side, the system counts consecutive observations on the new side. Until the count reaches the threshold, it holds the last confirmed status. src/…/confirmationThreshold.ts• L4-10 src/…/confirmationThreshold.ts• L70-106

Observation or eventConfirmation behavior
Same side as the last confirmed observationCommit the new status at once.
Opposite side below the thresholdKeep the confirmed status, but retain the new latency and error detail.
Opposite side reaches the thresholdCommit each observed status in the pending run and mark an unhealthy run with its confirmation note.
Recovery reaches the thresholdCommit UP for the pending run and clear held error text.
NO_DATA observationPass through as neutral. It does not advance or reset the count.
Incident or maintenance overlayFreeze the count for that minute and stop a pending run at the overlay boundary.
Manual push or default-status fillDo not advance the confirmation count.

The worker records the raw observed status before it resolves the displayed status. This preserves the actual check result for later confirmation and diagnosis. Confirmation applies only when the threshold is above one and the result type is REALTIME, TIMEOUT, or ERROR. It does not apply when an incident or maintenance overlay is active. src/…/monitorExecuteQueue.ts• L135-164 src/…/monitoring.ts• L23-36

The final sample uses this precedence: a default status supplies a value when the check returns NO_DATA, then the check result is applied, and incident or maintenance overlays can replace it. The worker preserves the check latency, raw status, and most specific error message while applying the visible status. src/…/monitorExecuteQueue.ts• L166-237

References: src/…/confirmationThreshold.ts• L4-10 src/…/confirmationThreshold.ts• L45-106 src/…/monitorExecuteQueue.ts• L135-164 src/…/monitorExecuteQueue.ts• L166-237 src/…/monitoring.ts• L23-36

Result states

The status describes service health, while the result type describes where or how the sample came from. This distinction lets the system show a held or overlaid status without losing the check's source and evidence.

Field or valueMeaning
UPThe target meets the monitor's healthy rule.
DEGRADEDThe target responds, but it is outside the healthy range or reports a partial health state.
DOWNThe target fails the monitor rule or the check cannot complete.
NO_DATAThe monitor has no usable signal yet, or the check has no data to report.
REALTIMEA normal scheduled check produced the result.
TIMEOUTThe check exceeded its time limit.
ERRORThe check or its evaluation failed.
SIGNALAn accepted heartbeat was recorded for later heartbeat evaluation.
DEFAULTA configured default status filled a NO_DATA result.
INCIDENT / MAINTENANCEA manual status overlay replaced the displayed result for the time window.

The stored record can contain both status and raw_status. status is the value used by downstream views and alerts after confirmation and overlays. raw_status is the status observed by the service before those rules. SSL results can also carry certificate expiry, issuer, and trust information for operational review. src/…/monitor.ts• L7-20 src/…/monitoring.ts• L42-57

References: src/…/global-constants.ts• L7-12 src/…/global-constants.ts• L36-50 src/…/monitor.ts• L7-20 src/…/monitoring.ts• L42-57

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the supported type list in src/…/monitor.ts aligned with the dispatcher branches in src/…/service.ts and the type-data shape in src/…/monitor.ts.
  • Keep the type editor and dispatcher aligned. A type that can be selected and saved must have a matching service check and result contract.
  • Preserve the minute timestamp and execution de-duplication contract between src/…/cron-minute.ts and src/…/monitorExecuteQueue.ts; changing either can create duplicate or missing samples.
  • Keep raw_status, status, and result type together from the execution worker through monitorResponseQueue and InsertMonitoringData; confirmation depends on the raw value and alert rules depend on the stored type.
  • If a new result type is added, decide whether it is visible to alert evaluation and confirmation counting in src/…/monitoring.ts.
  • Treat overlays as a status and confirmation boundary. Changes to merge order or overlay types can alter both the public status and the next confirmed flip.
  • When changing heartbeat timestamp storage, preserve compatibility with both second and millisecond values in heartbeatCall.
  • When changing group member status rules, keep the group delay and the latest-member-result lookup consistent so a group does not evaluate before its members.
  • Keep Prometheus noDataStatus separate from errorStatus. An empty query result means the query ran with no matching sample, while an unreachable or malformed response means the data source did not provide a usable answer.
  • Keep API and Prometheus secret transport warnings aligned with the fields that can carry secret references. Plain HTTP targets and proxy URLs must remain visibly different from HTTPS targets.
  • Keep custom evaluator status values and latency output aligned with the sandbox result contract. Changes to evaluator limits or supported helper modules can turn a saved evaluator into an execution error.
  • Preserve SSL threshold ordering and zero as a valid DOWN limit. Changes to form defaults can silently change certificate health policy when a monitor is reopened.
  • Keep Docker connection defaults, connection-mode changes, and TLS field clearing aligned with the saved monitor data. A stale TLS key or an incorrect default can silently select the wrong daemon or expose credentials.

Important failure modes

TriggerConsequenceGuard
A monitor has a type outside the supported type listIts scheduled job is rejected before execution.Validate type configuration against MONITOR_TYPES before adding execution work.
API configuration is missing, or a ping or TCP monitor has no hosts dataThe service records DOWN with an ERROR result instead of leaving a timeline gap.Migrate old monitor data and validate type-specific configuration before scheduling it.
A custom API, ping, TCP, or game evaluator throws or returns an invalid shapeThe sample becomes DOWN with an error result type instead of a healthy result.Return the expected status and latency object from the evaluator.
A custom evaluator exceeds its time, memory, message, or concurrency limitThe evaluation fails and the monitor cannot use the custom result.Keep evaluator work bounded and return one supported status with numeric latency.
A game query failsThe monitor records DOWN with an ERROR result and a bounded error message.Check the game type, host, port, and server reachability.
An API request times outThe monitor records the evaluated status with a TIMEOUT result type.Set a suitable request timeout and treat timeout type separately from normal REALTIME results.
A Prometheus query returns an empty vector or NaNThe monitor records its configured no-data status with zero chart latency.Set noDataStatus for the meaning of an empty metric result.
Prometheus cannot be reached or returns a non-success or malformed responseThe monitor records its configured error status with an ERROR or TIMEOUT result type.Set errorStatus separately from noDataStatus and inspect the error message.
A Prometheus value matches both threshold rulesThe DOWN result wins over DEGRADED.Define overlapping rules with the down-first order in mind.
A heartbeat has never been receivedThe monitor remains NO_DATA, not DOWN.Send and authenticate the heartbeat signal before relying on age thresholds.
ICMP cannot run in the host environmentPing falls back to DNS reachability and may no longer represent ICMP health.Check runtime permissions and treat the fallback as a different reachability signal.
A Docker daemon answers with a non-OK ping responseThe monitor reports DOWN because the endpoint is not a confirmed Docker Engine.Point the monitor at the Docker Engine endpoint and avoid proxy or login-page endpoints.
A Docker container is missing, paused, stopped, restarting, or unhealthyThe monitor reports DOWN or DEGRADED with a state-specific reason.Check the container name and its Docker state or health check.
Docker TCP is used without TLS outside a trusted networkAnyone who can reach the daemon may control the host.Use a Unix socket or TLS, and restrict plain TCP to a trusted network.
A group member has no latest resultThat member is omitted from the group calculation.Ensure member monitors run and produce current samples before judging the group.
A check stays on the opposite side for fewer than the confirmation thresholdThe displayed status stays on the prior side while raw evidence records the change.Inspect raw_status and the grace-period message before diagnosing a missed transition.
An incident or maintenance overlaps a checkThe overlay wins the displayed status and freezes confirmation counting.Read the overlay type and raw status when reviewing the sample.
A secret reference is sent to an HTTP target or proxyCredentials or other secret values can travel in cleartext.Use HTTPS or a trusted network and heed the API or Prometheus editor warning.
The response queue cannot write the sampleThe cache and alert flow do not receive that result.Monitor queue failures and database write errors.

Key files

FileWhy to read it
src/…/appScheduler.tsShows how active monitor schedules are created and removed.
src/…/cron-minute.tsDefines the handoff from a schedule to a minute-based execution job.
src/…/service.tsShows the single dispatch point for all monitor types.
src/…/monitorExecuteQueue.tsShows execution, default status, overlays, confirmation, and response handoff.
src/…/monitorResponseQueue.tsShows persistence, last-status caching, and alert handoff.
src/…/confirmationThreshold.tsDefines side changes, pending runs, neutral samples, and confirmation.
src/…/monitoring.tsDefines which stored samples count for alerts and confirmation.
src/…/monitor.tsDefines monitor result fields and the configuration data for each type.
src/…/apiCall.tsDefines HTTP request evaluation, timeout results, and malformed configuration handling.
src/…/evalSandbox.tsDefines the safety boundary and result contract for custom monitor evaluators.
src/…/pingCall.tsDefines multi-host reachability evaluation and ping evaluator failures.
src/…/tcpCall.tsDefines multi-host port checks and TCP evaluator failures.
src/…/gamedigCall.tsDefines game server queries and game evaluator failures.
src/…/prometheusCall.tsDefines PromQL result parsing, threshold evaluation, and separate no-data and error outcomes.
src/…/dockerCall.tsDefines Docker daemon and container health outcomes.
src/…/heartbeatCall.tsExplains signal age and the NO_DATA heartbeat state.
src/…/groupCall.tsExplains weighted member status and group latency.
src/…/monitorsController.tsShows heartbeat registration and signal persistence.
src/…/GeneralSettingsCard.svelteShows schedule, default status, visibility, and confirmation settings.
src/…/MonitorTypeCard.svelteShows supported monitor choices, validation, save flow, and immediate test flow.
src/…/monitor-api.svelteShows API request, redirect, evaluator, and secret transport settings.
src/…/monitor-prometheus.svelteShows Prometheus query, threshold, status, and request settings.
src/…/monitor-ssl.svelteShows certificate expiry, trust, timeout, and SNI settings.
src/…/monitor-docker.svelteShows Docker connection modes, daemon or container checks, and container selection.
src/…/monitor-docker.svelte.test.tsConfirms Docker defaults, saved connection values, TLS fields, and check-mode behavior.