Skip to main content

Nanokvm Health

@figy/nanokvm-healthv2026.10.17.3· MIT· 7d agoWORKFLOWS
01README

fi.gy's scheduled NanoKVM health: check the out-of-band KVM on my LAN every 15 minutes, forward its health to the swamp-managed OpenTelemetry collector, and publish a fleet health report. WHAT IT DOES

The private, site-specific half of NanoKVM monitoring. The portable model that talks to a Sipeed NanoKVM — self-signed TLS, dual-firmware login, and a pass/warn/fail verdict — lives in @svendowideit/nanokvm. One workflow pins it to my device (password in the nanokvm vault) and my collector on a 15 minute cron, requiring @svendowideit/nanokvm-health-report. A device that is off is not a failure — it is a fail verdict, emitted like any other sample, so a flapping device leaves a trail. Two more workflows publish each device as <name>.fi.gy (A records via the shared Caddy, which also renews a Let's Encrypt certificate for the name) and install that certificate onto the KVM itself, so the device's web UI serves a publicly trusted certificate.

INSTALL

swamp extension pull @figy/nanokvm-health

DEPENDENCIES

@svendowideit/nanokvm, @svendowideit/curl and @svendowideit/caddy (pulled automatically), a device reachable at the configured address, the login password stored in the nanokvm vault (swamp vault create @svendowideit/systemd-creds nanokvm then swamp vault put nanokvm NANOKVM_PASSWORD), and a running OTLP gateway listening on 127.0.0.1:4318 (the @svendowideit/otel-gateway). Without the gateway the emit step still runs and records why it skipped. The DNS/certificate workflows additionally need the nanokvm-caddy repo model (created once; see the README).

RUN

# Run it now, once, instead of waiting for the 15-minute trigger.
swamp workflow run @figy/nanokvm-health

# Check a different device on the same LAN (any input can be overridden).
swamp workflow run @figy/nanokvm-health --input host=10.10.12.231

# Read the fleet health report this run produced.
swamp report get @svendowideit/nanokvm-health-report \
  --workflow @figy/nanokvm-health --markdown

# Publish every NanoKVM swamp looks after as <name>.fi.gy A records and
# declare the name for a Let's Encrypt certificate (run after adding or
# moving a device). Caddy then issues and renews the certificate.
swamp workflow run @figy/nanokvm-dns

# Install the renewed certificate onto the device (scheduled daily; the
# KVM has no cert-upload API, so it is written via the admin script API).
swamp workflow run @figy/nanokvm-cert

CONFIGURE

Inputs (all overridable per run; the defaults are my repo): device, host, port, username, vaultName, passwordRef, curlModel, otelModel, otelEndpoint, otelMesh, otelVaultName, otelTokenRef. host and vaultName are the ones that matter — the address of the KVM and the vault holding its password. The trigger itself is read-only inside an extension; change the schedule from the host with swamp workflow trigger set @figy/nanokvm-health --schedule "…". @figy/nanokvm-dns takes caddy (the repo caddy model), nanokvmModel (the instance whose devices scan runs), zone (default fi.gy) and ttl. @figy/nanokvm-cert takes device, host, zone, certDir (Caddy's certificate store) and vaultName/passwordRef. See the README for the full tables.

UPGRADE

This extension installs nothing on the host, so an upgrade has nothing to rebuild or reconcile. Refresh the pulled workflow with one idempotent command:

  # Pull the newest published copy of the workflow.
  swamp extension update

The device model it drives is upgraded by its own extension's upgrades entry on the next method run.

WHAT IT INSTALLS

Nothing on the host — no services, cron triggers, daemons or webhooks. The schedule is a swamp trigger evaluated by swamp serve; it runs the @svendowideit/nanokvm model, which talks to the device and the collector and writes swamp data.

02Workflows3
@figy/nanokvm-healtha314833d-0c2b-455f-86ab-24c26973a543

fi.gy's scheduled NanoKVM health: check the out-of-band KVM at 10.10.12.230, forward its health to the swamp-managed OpenTelemetry collector, and publish a fleet health report. This is the concrete, site-specific half. The portable model that knows how to talk to a NanoKVM (self-signed TLS, AES login, cookie session, health verdict) lives in @svendowideit/nanokvm; this workflow pins it to my device and my collector. Every 15 minutes it runs `health`, asks the model to `emit` the latest verdict

healthCheck the device and forward its health to OTel.
1.check— Run the read-only NanoKVM health check (always records a verdict).
2.emit— Push the latest health to the OTLP receiver. A no-op that records the reason when no collector is configured, so it is safe to leave enabled.
3.assert-checked— Confirm the health step produced a record (not that the device is up).
@figy/nanokvm-dns74f2d24a-3d56-4270-9297-2a367a678007

fi.gy's NanoKVM DNS: publish every NanoKVM swamp looks after as <name>.fi.gy A records, reconciled into the shared Caddy — without giving any KVM its own Caddy. It discovers the devices from the repo with @svendowideit/nanokvm's `devices` method (a scan of the model definitions, not the network), so adding a KVM is just adding a model definition: the next run publishes it. Each device's address becomes an A record named after its model instance (`nanokvm` -> nanokvm.fi.gy), plus an entry for an

dnsDiscover the NanoKVM devices and reconcile their A records into the shared Caddy.
1.discover— Scan the repo's model definitions for @svendowideit/nanokvm instances and record each device's name, address and fqdn plus an A-record list.
2.tls— Ensure the model has a DNS provider (Gandi, inferred from its plugins and environment file) and declare each device name as a TLS subject, so Caddy issues and renews a Let's Encrypt certificate for it via DNS-01. No reverse-proxy route: the name points at the KVM itself.
3.dns— Reconcile the discovered A records — merged with this Caddy's peer models' records — into Caddy.
4.assert-applied— Confirm the DNS reconcile wrote its dnsConfig record.
@figy/nanokvm-cert2299ea7a-de44-4425-a3cf-a39fa152ed28

fi.gy's NanoKVM TLS: install the Let's Encrypt certificate Caddy issued for <name>.fi.gy onto the device and keep it current. The NanoKVM has no certificate-upload endpoint, so this drives @svendowideit/nanokvm's `cert install`, which writes /etc/kvm/server.crt and .key on the device through its admin script API and restarts the web server. The certificate files are taken from Caddy's store (~/.local/share/caddy/certificates), where Caddy issued them and renews them automatically via DNS-01 (@f

certInstall the Caddy-issued certificate onto the device and verify it is served.
1.install— Locate the Caddy-issued certificate for the device's name, push it onto the device through the admin script API, restart the server and verify the device serves it.
2.assert-installed— Confirm the device now serves a certificate carrying its name.
03Stats
A
100 / 100
Downloads
4
Archive size
9.7 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned
04Platforms