Exports Prometheus metrics for Tailscale devices and keys
|
||
---|---|---|
.github/workflows | ||
pkg | ||
Dockerfile | ||
go.mod | ||
go.sum | ||
main.go | ||
README.md |
tailscale-exporter
Exports Prometheus metrics for Tailscale devices and keys.
Metrics
tailscale_devices_expiry_seconds_remaining
- The number of seconds remaining until the device authentication expirestailscale_devices_expiry_time
- The timestamp (as Unix timestamp) that the device expirestailscale_devices_update_available
- Whether the device can be updated to a newer version of Tailscale or nottailscale_keys_expiry_seconds_remaining
- The number of seconds remaining until the key expirestailscale_keys_expiry_time
- The timestamp (as Unix timestamp) that the key expires
Configuration
The following environment variable can be used to configure the exporter:
TAILSCALE_API_KEY
- A valid Tailscale API key [Required]TAILSCALE_TAILNET
- The Tailnet to export metrics for [Required]PORT
- The port to run the exporter on (Defaults to8080
)
Running with Docker
export TAILSCALE_API_KEY="my-tailscale-api-key"
export TAILSCALE_TAILNET="my-tailnet.github"
docker run --rm -it -p 8080:8080 -e TAILSCALE_API_KEY -e TAILSCALE_TAILNET averagemarcus/tailscale-exporter:latest
Then visit: http://localhost:8080/metrics
Deploying to Kubernetes
apiVersion: v1
kind: Secret
metadata:
name: tailscale-exporter
labels:
app.kubernetes.io/name: tailscale-exporter
stringData:
TAILSCALE_API_KEY: xxxx
TAILSCALE_TAILNET: xxxx
---
apiVersion: v1
kind: Service
metadata:
name: tailscale-exporter
labels:
app.kubernetes.io/name: tailscale-exporter
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: 8080
selector:
app: tailscale-exporter
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tailscale-exporter
labels:
app.kubernetes.io/name: tailscale-exporter
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: tailscale-exporter
template:
metadata:
labels:
app.kubernetes.io/name: tailscale-exporter
spec:
containers:
- name: tailscale-exporter
image: averagemarcus/tailscale-exporter:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
name: metrics
envFrom:
- secretRef:
name: tailscale-exporter