Repository navigation
[2.0.0] — 2026-11-27
Headless mode is the headline: the engine that has always shipped inside the desktop app
now also runs as a standalone daemon for servers and containers, with its own HTTP
surface, man page and completions, container image, .deb/.rpm packages and
deployment tooling. Existing installs keep their settings, history and backups, so the
major number marks a new distribution channel rather than a break in the desktop app.
Added
docs/headless-migration.mdis the switch-over guide from the desktop app: what carries over unchanged (the app's own export, its alert thresholds, theTargetStatsJSON), what has to be replaced (live table, tray notifications, 30-day history), a parity check with--once, exposing the HTTP surface behind a TLS proxy, the overlap-and-rollback procedure, and the surprises (netstudio_target_upabsent before the first sample,-1sentinels, counter and event-cursor resets on restart,CAP_NET_RAWfor hardened units).deploy/grafana/netstudio-headless.jsonimports as a complete dashboard: readiness, offline/degraded/stale counts, per-target state history, RTT (avg/max), jitter, loss, time since the last success, request rate, reload outcomes, TLS expiry and failures by kind, with the Prometheus data source picked through adatasourcevariable.deploy/grafana/README.mdcovers importing and ConfigMap provisioning, andtool/headless-grafana-check.py(run in CI next to the man page check) rejects a panel that queries a metric the daemon does not emit or legends a label the series does not carry.- Headless docs are now checked, not just written:
tool/headless-docs-check.pycompares the flags incli.rswithdocs/netstudio-headless.1and both completions, rejects duplicated option blocks and a stale.THversion, and CI renders the man page with groff and syntax-checks the completions. The man page gained the missing--listenentry, an HTTP-endpoints section, and lost a duplicated--windows-serviceblock. - CI builds
native_engine/Dockerfileon every push and boots the image: preflight against the example config,/healthz,/readyz,/metrics,/api/v1/events, the pid-file-less status file, and the image's own--health-check, so a broken image fails the run instead of the deployment. - The headless documentation overstated what was missing:
SIGHUPreload and bearer-token authentication shipped earlier, so "What is not included" now names only TLS termination and user accounts — which is exactly what the migration guide tells you to put in a reverse proxy. - Headless
GET /api/v1/events?since=<seq>serves the alert feed: one event perdown/uptransition (withoutage_mson recovery), a monotonic cursor the client passes back, anddroppedwhen the 256-event ring buffer evicted transitions before that cursor. Muted targets stay out, the feed sits behind the bearer token, and every transition is also logged. deploy/alerting/netstudio-alert-bridge.pyforwards that feed to Slack, Mattermost, ntfy or any HTTPS webhook with retries and a restart-safe cursor, so the daemon itself still needs no TLS client or certificate store.- Headless / CLI mode: a standalone
netstudio-headlessbinary built from the same Rust engine, for servers and containers. It reads the app's JSON export (full envelope or bare target array), supports--check,--once,--interval,--probe-concurrency,--output(atomic snapshot file),--pid-file,--quiet,--format,--colorand--log-level, streams color-coded tables on a terminal (NDJSON when piped), and optionally serves/healthz,/readyz,/metrics(Prometheus) and/api/v1/status. Snapshots report sanitizedlast_error/last_error_kind, TCP fallback, and staleness. Handles SIGINT/SIGTERM gracefully and returns0/3from--oncedepending on target health. No new crates; documented in docs/headless.md. - Headless
--checknow pre-flights the whole deployment, not just the JSON: it verifies the--outputand--pid-filedirectories are writable, refuses a pid file held by a live process, and binds--listenonce. Failures exit2with a per-channel report (--format jsonemits"type": "check"), so a CI job orExecStartPrecatches a bad mount or a busy port before the service restart-loops. - Headless documentation helpers:
docs/netstudio-headless.1man page and bash/zsh completions indocs/completions/. - Standalone headless packaging: a multi-stage
native_engine/Dockerfile(unprivileged user, ICMP via--cap-add NET_RAW) and per-platformnetstudio-headless-<os>-<arch>release archives that contain only the daemon and an example config. - Headless HTTP can require a bearer token (
--http-token-fileorNETSTUDIO_HTTP_TOKEN): every endpoint except/healthzreturns401without it, the comparison is constant-time, and--checkvalidates the token file. TLS still belongs in a reverse proxy. --checknow follows the same output rule as--onceand the daemon: text on a terminal, JSON when stdout is piped (override with--format), so a CI job can pipe the report straight intojq.- Headless daemon reloads its config on
SIGHUP(Unix): added, removed and edited targets are applied in place, unchanged targets keep their counters, alert thresholds take effect immediately, and a malformed file is logged without stopping the daemon. The same signal re-reads--http-token-file, so the bearer token can be rotated without a restart; an unreadable or empty file keeps the previous secret and only logs a warning. - Headless
--windows-serviceruns under the Windows Service Control Manager: it reportsSERVICE_RUNNINGonly once serving, stops gracefully onSERVICE_CONTROL_STOP, and shipstool/install-headless-service.ps1to register, restart on failure and remove the service. - Headless releases now ship
.deband.rpmpackages with a hardened systemd unit (deploy/linux/,tool/headless-sbom.py), built indebian:bullseyeso one binary covers Debian 11-13, Ubuntu 20.04+ and RHEL 9+. - Headless
--health-check <URL>sends one HTTP GET and exits0only on200, so a container image without curl can still declare aHEALTHCHECK(the image now does, against/readyz);deploy/kubernetes/adds a ConfigMap, Deployment and Service with strict readiness. - Headless
--log-file <PATH>mirrors every log line into a file (rotated toPATH.1at 8 MiB, never truncated on restart), so a service or container without a console can keep its diagnostics. - Headless config validation is stricter: an unknown
protocolvalue skips the target instead of silently probing ICMP, keys the loader does not read are reported (unknown key "porrt" is ignored), and two targets on the sameprotocol host:portare flagged as duplicates. docs/netstudio-headless.schema.jsondescribes the target file (types, ranges, defaults); a test keeps it in step with the keys the loader reads.- Headless
--watch-config <SECS>polls the config file and reloads it on change, which gives Windows (noSIGHUP) and containers the same hot reload; a broken file is attempted once per edit instead of once per poll. - Headless
--probe-intervaloverrides every target'sinterval_msfrom the command line (1–3600 s), so one flag retunes a mixed config without editing it;--intervalremains the snapshot cadence. - Snapshots and
/metricsgained "last successful probe" data:last_success_epoch_msper target andnetstudio_target_last_success_timestamp_seconds(a failure moves the check timestamp, never this one). /readyzanswers503withRetry-After: 1while targets still have no sample, so probes back off instead of hammering a starting daemon./metricsnow also describes the daemon:netstudio_uptime_seconds,netstudio_ready,netstudio_targets_configured,netstudio_stale_targets,netstudio_last_snapshot_duration_seconds,netstudio_config_reloads_total{result}andnetstudio_http_requests_total{path,status}, so a wedged prober or a failing reload is alertable instead of looking like a healthy scrape.- Headless
--log-format jsonwrites one JSON object per stderr line (time,level,msg, escaped, no ANSI) for log collectors, while the default text format is unchanged. - Headless config honours
groupand"is_muted"; both flow into the text table, snapshot JSON, and Prometheus (newnetstudio_target_muted,grouplabel on every target metric). Muted targets are still probed but no longer make--onceexit3.summarygainedmuted. - The desktop app's JSON backup now includes
settings.offline_after/recover_afterwhen the shell has configured them, so an exported file reproduces the app's alert thresholds under the daemon.
Fixed
- The headless container image actually contains the daemon.
COPYkeeps the checkout's mtimes, which are older than the dependency-cache layer's stub build, and cargo fingerprints by mtime: the second build printedFinishedand the image shipped the stubfn main() {}— it started, printed nothing and exited0, so the container never listened. The build stage now refreshes the copied sources' timestamps, drops the crate's release artifacts and fails unless the binary answers--version, and CI asserts the output of--versionand--checkinstead of only their exit codes. - Headless: the last-check timestamp is now written when a probe sample completes instead of on every snapshot, so a stalled prober no longer looks fresh;
- Headless:
--outputand--pid-filepaths are validated before the probe loop starts; a daemon with an unusable output path used to log the same error every interval forever and now exits2. A write failure that appears later is logged once (with a recovery line when writes succeed again) instead of on every tick. - Headless: the first probe fires immediately at startup.
/readyzis now strict — it stays503until every target has a real sample — andnetstudio_target_upis absent until that target has one, so a scrape can no longer be mistaken for "all targets up" or "ready". - Headless:
--listen/--pid-filecombined with--onceare rejected (exit2) instead of being silently ignored;--check --format jsonprints JSON instead of text; the pid file is claimed with an exclusive create and a stale file from a killed process is taken over (a live one aborts startup), with cleanup on graceful stop. - Headless text tables now measure display width, so CJK, Hangul, and emoji target names keep their columns aligned instead of shifting them by one cell per wide glyph.
/metricsgainednetstudio_target_stale,netstudio_target_last_sample_age_seconds,netstudio_target_tcp_fallbackandnetstudio_target_error_info. The HTTP server now uses a fixed worker pool with request timeouts and bounded queues (no thread per connection), returning400/413/408for bad input. - The 2.0.0 release run failed at "Install packaging tools": Debian 11's suite indexes still came from
deb.debian.org, but the package files had moved toarchive.debian.org, so apt resolved the current versions and 404ed every download. The packaging job now points apt at the archive (and ignoresValid-Until), still building onbullseyeso the.deb/.rpmkeep their glibc 2.31 floor. The job also installsprocpsandman-db, which the minimal image lacks andsystemd-analyze verifyneeds to checkExecReload=/bin/killand theDocumentation=man:reference. - The Add Server dialog now exposes the per-target timeout next to the interval field, with
100–10000ms validation matchingNativeBindings.clampTimeout; the dialog title also ellipsizes instead of overflowing on narrow or localized layouts (#2).