kaisar run can serve Prometheus metrics and health checks for your own monitoring. It is off by default: without --metrics-bind, no port is opened.
The endpoint only describes this machine. It never contains the node key, the node ID, the hardware fingerprint, a wallet, an IP address or task IDs.
Turn it on
- Start the node with a local address:
kaisar run --metrics-bind 127.0.0.1:9464- Check it from the same machine:
curl -s http://127.0.0.1:9464/metrics| Path | Token | Answers |
|---|---|---|
/metrics | Required when a token is set | Prometheus text format |
/healthz | Never | OK while the node keeps reporting (within 120 seconds); always OK while linking |
/readyz | Never | OK when linked and the last heartbeat succeeded |
/healthz and /readyz hold no numbers. The endpoint accepts at most 8 connections at once and allows 2 seconds per request: give probes a timeout of 3 seconds or more.
Where it may listen
| Address | Allowed |
|---|---|
127.0.0.1 (this machine) | Yes |
| Private address (10.x, 172.16–31.x, 192.168.x, 100.64.x, IPv6 fc00::/7) | Only with a token file |
Public address, 0.0.0.0, ::, link-local | Never: the node exits with error KN-2301 |
A busy port, or a missing or short token file, stops the node with error KN-2302.
Use a token
- Create a token file of at least 32 characters, readable by the node user:
openssl rand -hex 32 > kaisar-metrics.token- Start the node on a private address with the token file:
kaisar run --metrics-bind <private ip>:9464 --metrics-token-file kaisar-metrics.token- Point Prometheus at it with the same token:
scrape_configs:
- job_name: kaisar-node
scrape_interval: 30s
authorization:
credentials_file: /etc/prometheus/kaisar-metrics.token
static_configs:
- targets: ["<private ip>:9464"]The same settings work as environment variables: KAISAR_METRICS_BIND and KAISAR_METRICS_TOKEN_FILE.
Metrics
Every name starts with kaisar_node_. Names stay stable; if one is renamed, both names are served for two releases.
| Metric | Type | Meaning |
|---|---|---|
kaisar_node_build_info | gauge | Always 1; labels version, runtime |
kaisar_node_uptime_seconds | gauge | Seconds since kaisar run started |
kaisar_node_linked | gauge | 1 when this machine is linked |
kaisar_node_online | gauge | 1 when the network sees it online |
kaisar_node_state | gauge | 1 for the current state: starting, online, paused, not_open, offline |
kaisar_node_owner_paused | gauge | 1 when paused from Kaisar App |
kaisar_node_heartbeats_total | counter | Heartbeats sent |
kaisar_node_last_heartbeat_timestamp_seconds | gauge | Time of the last successful heartbeat |
kaisar_node_tasks_total | counter | Tasks by role (provider, checker) and result (leased, committed, submitted, failed, released, skipped, dropped) |
kaisar_node_task_errors_total | counter | Task errors |
kaisar_node_lease_extensions_total | counter | Task leases extended |
kaisar_node_task_running | gauge | 1 while a task runs |
kaisar_node_task_queue_depth | gauge | Tasks this machine holds |
kaisar_node_pending_results | gauge | Results waiting to be submitted |
The CLI does not report CPU or GPU usage yet; use your usual node exporter for that.
Example alerts
groups:
- name: kaisar-node
rules:
- alert: KaisarNodeOffline
expr: kaisar_node_state{state="offline"} == 1
for: 5m
- alert: KaisarNodeTasksFailing
expr: increase(kaisar_node_tasks_total{result=~"failed|dropped"}[24h]) >= 3
- alert: KaisarNodeNotOpen
expr: kaisar_node_state{state="not_open"} == 1Docker
Inside a container, 127.0.0.1 is the container itself, so a published port cannot reach it. Give the container a fixed private address on its own network, listen there with a token, and publish the port to the host only:
services:
kaisar-node:
environment:
KAISAR_METRICS_BIND: 172.30.94.10:9464
KAISAR_METRICS_TOKEN_FILE: /run/secrets/kaisar-metrics.token
volumes:
- ./kaisar-metrics.token:/run/secrets/kaisar-metrics.token:ro
ports: ["127.0.0.1:9464:9464"]
networks:
kaisar: { ipv4_address: 172.30.94.10 }
networks:
kaisar:
ipam: { config: [{ subnet: 172.30.94.0/24 }] }Add these lines to the Compose file from Run in Docker. The token file must be readable by UID 65532.
Kubernetes
- Create the token Secret:
kubectl -n kaisar create secret generic kaisar-metrics --from-literal=token=$(openssl rand -hex 32)- Turn metrics on in
values.yaml, thenhelm upgrade:
metrics:
enabled: true
token: { existingSecret: kaisar-metrics }
serviceMonitor: { enabled: true }
allowFrom:
- namespaceSelector: { matchLabels: { kubernetes.io/metadata.name: monitoring } }The pod listens on its own IP on port 9464 behind a ClusterIP Service, never a NodePort or LoadBalancer. The ServiceMonitor needs the Prometheus Operator and the token Secret in the same namespace. Only the sources in allowFrom can scrape.
- IPv4 pods only. On an IPv6 or IPv6-first dual-stack cluster the pod address is refused (error KN-2301); metrics through the chart are not supported there yet.
- Strict network plugins. Probes come from the server's own IP. If your plugin blocks traffic from the host (for example Cilium with
policy-enforcement: always), allow it to the metrics port, or the liveness probe fails and the pod restarts.