{"id":29874687,"url":"https://github.com/josh/tailscale_exporter","last_synced_at":"2026-05-17T15:38:04.569Z","repository":{"id":307074998,"uuid":"1028211180","full_name":"josh/tailscale_exporter","owner":"josh","description":"Prometheus exporter for Tailscale device metrics","archived":false,"fork":false,"pushed_at":"2025-10-01T12:37:06.000Z","size":163,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-01T14:36:52.476Z","etag":null,"topics":["metrics","monitoring","prometheus","prometheus-exporter","tailscale"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-07-29T07:34:21.000Z","updated_at":"2025-10-01T12:36:08.000Z","dependencies_parsed_at":"2025-07-29T10:38:26.559Z","dependency_job_id":"1a3b5cbf-2e69-4e38-aad5-58d302d8c907","html_url":"https://github.com/josh/tailscale_exporter","commit_stats":null,"previous_names":["josh/tailscale_exporter"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/josh/tailscale_exporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josh%2Ftailscale_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josh%2Ftailscale_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josh%2Ftailscale_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josh%2Ftailscale_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josh","download_url":"https://codeload.github.com/josh/tailscale_exporter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josh%2Ftailscale_exporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278877092,"owners_count":26061381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metrics","monitoring","prometheus","prometheus-exporter","tailscale"],"created_at":"2025-07-31T01:00:29.212Z","updated_at":"2025-10-08T02:10:42.455Z","avatar_url":"https://github.com/josh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tailscale Prometheus Exporter\n\nA Prometheus exporter that collects device metrics from your Tailscale network (tailnet). This exporter provides visibility into device status, authentication expiry, and update availability across your Tailscale infrastructure.\n\n## Metrics\n\nThe exporter collects the following metrics:\n\n- **`tailscale_devices_expiry_time`** - The expiry time of device authentication (Unix timestamp)\n- **`tailscale_devices_last_seen`** - The last time the device was active (Unix timestamp)\n- **`tailscale_devices_update_available`** - Whether the Tailscale device has a client update available (0 or 1)\n\nAll metrics include labels:\n\n- `name` - Device hostname (short domain)\n- `address` - Device IP address\n- `owner` - Device owner (user:username or tag list)\n\n## Authentication\n\nThe exporter supports multiple authentication methods with Tailscale:\n\n### API Key\n\n```sh\n--ts-apikey=tskey-api-xxxxx\n# or\nexport TS_API_KEY=tskey-api-xxxxx\n```\n\n### OAuth\n\n```sh\n--ts-oauth-id=your-oauth-id --ts-oauth-secret=your-oauth-secret\n# or\nexport TS_OAUTH_ID=your-oauth-id\nexport TS_OAUTH_SECRET=your-oauth-secret\n```\n\n### Auth Key\n\n```bash\n--ts-authkey=tskey-auth-xxxxx\n# or\nexport TS_AUTHKEY=tskey-auth-xxxxx\n```\n\n## Usage\n\n### Serve Mode\n\nRun as a persistent HTTP server exposing Prometheus metrics:\n\n```bash\ntailscale_exporter serve [options]\n```\n\n**Options:**\n\n- `-l, --listen` - Address to listen on (default: `:9824`)\n- `-i, --interval` - Metrics collection interval (default: `15m`)\n- `--ts-tailnet` - Tailnet to query (default: `-` for your default tailnet)\n- `--ts-hostname` - Hostname for the exporter's Tailscale node (default: `tailscale_exporter`)\n- `-v, --verbose` - Enable verbose logging\n\nMetrics will be available at `http://localhost:9824/metrics`\n\n**Example:**\n\n```sh\n# Run with API key authentication\n$ export TS_API_KEY=tskey-api-xxxxx\n$ tailscale_exporter serve --listen=:9824 --interval=5m\n\n# Run on custom port with verbose logging\n$ tailscale_exporter serve -l :8080 -v --ts-apikey=tskey-api-xxxxx\n```\n\n### Generate Mode\n\nGenerate metrics once and exit (useful for batch jobs or cron):\n\n```sh\n$ tailscale_exporter generate [options]\n```\n\n**Options:**\n\n- `-o, --output` - Output file path (defaults to stdout)\n- `-p, --pushgateway-url` - Pushgateway URL to send metrics to\n- `-r, --pushgateway-retries` - Number of retries for Pushgateway requests (default: `1`)\n\n**Examples:**\n\n```sh\n# Output to stdout\n$ tailscale_exporter generate --ts-apikey=tskey-api-xxxxx\n\n# Save to file\n$ tailscale_exporter generate -o metrics.txt --ts-apikey=tskey-api-xxxxx\n\n# Push to Pushgateway\n$ tailscale_exporter generate -p http://pushgateway:9091 --ts-apikey=tskey-api-xxxxx\n```\n\n## Environment Variables\n\nAll CLI options can be configured via environment variables:\n\n**Authentication:**\n\n- `TS_API_KEY` - Tailscale API key\n- `TS_AUTHKEY` - Tailscale auth key\n- `TS_OAUTH_ID` - OAuth client ID\n- `TS_OAUTH_SECRET` - OAuth client secret\n- `TS_TAILNET` - Tailnet to query\n- `TS_HOSTNAME` - Hostname for exporter's Tailscale node\n\n**Serve Mode:**\n\n- `TS_EXPORTER_LISTEN` - Listen address\n- `TS_EXPORTER_INTERVAL` - Collection interval\n- `TS_EXPORTER_VERBOSE` - Enable verbose logging\n\n**Generate Mode:**\n\n- `TS_EXPORTER_OUTPUT` - Output file path\n- `TS_EXPORTER_PUSHGATEWAY_URL` - Pushgateway URL\n- `TS_EXPORTER_PUSHGATEWAY_RETRIES` - Pushgateway retry count\n- `TS_EXPORTER_MODE` - Default subcommand (`serve` or `generate`)\n\n## Credential Loading\n\nThe exporter supports loading credentials from files or a credentials directory:\n\n```sh\n# Load from file\n--ts-apikey=file:/path/to/api-key.txt\n\n# Load from credentials directory (requires CREDENTIALS_DIRECTORY env var)\nexport CREDENTIALS_DIRECTORY=/etc/tailscale_exporter/credentials\n--ts-apikey=cred:tskey-api  # loads from $CREDENTIALS_DIRECTORY/tskey-api\n```\n\n## Installation \u0026 Deployment\n\n### Binary\n\n```sh\n$ go install github.com/josh/tailscale_exporter@latest\n```\n\n### Systemd\n\nSystemd service files are included in the `systemd/` directory:\n\n```sh\n# Copy service files\n$ sudo cp systemd/* /etc/systemd/system/\n\n# Enable and start\n$ sudo systemctl enable --now tailscale_exporter.service\n```\n\nThe service supports socket activation and includes a timer for periodic execution.\n\n## Prometheus Configuration\n\nAdd to your `prometheus.yml`:\n\n```yaml\nscrape_configs:\n  - job_name: \"tailscale\"\n    static_configs:\n      - targets: [\"localhost:9824\"]\n    scrape_interval: 60s\n```\n\n## Example Queries\n\n```promql\n# Devices with expired authentication\ntailscale_devices_expiry_time \u003c time()\n\n# Devices not seen in the last 24 hours\ntailscale_devices_last_seen \u003c (time() - 86400)\n\n# Devices with updates available\ntailscale_devices_update_available == 1\n\n# Count devices by owner\ncount by (owner) (tailscale_devices_last_seen)\n```\n\n## License\n\nSee [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosh%2Ftailscale_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosh%2Ftailscale_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosh%2Ftailscale_exporter/lists"}