brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: tailscale metrics print shows the client's own metrics

Network and access
~/tips/tip-tailscale-metrics-print-write

tailscale metrics print

Prints or writes the Tailscale client's usage metrics so a monitoring system such as Prometheus can read them.

The Tailscale client keeps counters about its own work, like traffic and health. You can look at them straight from the command line.

tailscale metrics print
tailscale metrics write /var/lib/prometheus/node-exporter/tailscaled.prom

The CLI reference describes tailscale metrics as a way to expose and collect client metrics for use with third-party monitoring systems. print shows them in the current terminal session, and write writes the values to a text file. The file path is the only argument.

The file route is meant for the textfile collector of the Prometheus node exporter. The client metrics page shows the path above as its example: write the file where the collector looks, run the command on a schedule, and the metrics appear in Prometheus. When the monitoring agent runs on the same host as the client, the docs say you can also scrape http://100.100.100.100/metrics.

print is the quick way to check what is available before you build a dashboard. Tailscale’s blog says it needs version 1.78 or later.

The caveat is that write is a snapshot. It writes the values once, so a stale file keeps its old numbers if your schedule stops, and your alerting will not notice. Run it from a systemd timer or cron job and watch the file’s age. The path above is the docs’ example, so use the directory your own collector reads.

Further reading: Tailscale docs: client metrics, Tailscale docs: CLI reference

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link