https://github.com/averagemarcus/tailscale-exporter
Exports Prometheus metrics for Tailscale devices and keys.
https://github.com/averagemarcus/tailscale-exporter
metrics prometheus prometheus-exporter tailscale
Last synced: over 1 year ago
JSON representation
Exports Prometheus metrics for Tailscale devices and keys.
- Host: GitHub
- URL: https://github.com/averagemarcus/tailscale-exporter
- Owner: AverageMarcus
- Created: 2023-07-29T20:52:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-02T09:26:54.000Z (almost 3 years ago)
- Last Synced: 2025-03-27T09:46:24.729Z (over 1 year ago)
- Topics: metrics, prometheus, prometheus-exporter, tailscale
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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 expires
* `tailscale_devices_expiry_time` - The timestamp (as Unix timestamp) that the device expires
* `tailscale_devices_update_available` - Whether the device can be updated to a newer version of Tailscale or not
* `tailscale_keys_expiry_seconds_remaining` - The number of seconds remaining until the key expires
* `tailscale_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 to `8080`)
## Running with Docker
```shell
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 ghcr.io/averagemarcus/tailscale-exporter:latest
```
Then visit: [http://localhost:8080/metrics](http://localhost:8080/metrics)
## Deploying to Kubernetes
```yaml
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: ghcr.io/averagemarcus/tailscale-exporter:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
name: metrics
envFrom:
- secretRef:
name: tailscale-exporter
```