Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/madjam002/tailscale-prometheus-sd
Prometheus Service Discovery for Tailscale which automatically discovers exporters running on nodes within your Tailscale Network (tailnet). Also works with Headscale.
https://github.com/madjam002/tailscale-prometheus-sd
headscale prometheus prometheus-service-discovery tailscale
Last synced: 26 days ago
JSON representation
Prometheus Service Discovery for Tailscale which automatically discovers exporters running on nodes within your Tailscale Network (tailnet). Also works with Headscale.
- Host: GitHub
- URL: https://github.com/madjam002/tailscale-prometheus-sd
- Owner: madjam002
- License: mit
- Created: 2022-12-09T16:12:48.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-26T15:27:05.000Z (10 months ago)
- Last Synced: 2024-11-06T00:39:51.479Z (about 2 months ago)
- Topics: headscale, prometheus, prometheus-service-discovery, tailscale
- Language: Nix
- Homepage:
- Size: 1.22 MB
- Stars: 14
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tailscale-prometheus-sd
Prometheus Service Discovery for Tailscale which automatically discovers exporters running on nodes within your Tailscale Network (tailnet).
Unlike alternatives in this space, tailscale-prometheus-sd uses the local Tailscale API and Tailscale Service Collection (https://tailscale.com/kb/1100/services/) to discover exporters running across your network.
As it uses the Tailscale localapi, it also works with [Headscale](https://github.com/juanfont/headscale) with a small patch needed to enable service collection:
```
diff --git a/api_common.go b/api_common.go
--- a/api_common.go
+++ b/api_common.go
@@ -63,8 +63,9 @@
Domain: h.cfg.BaseDomain,
PacketFilter: h.aclRules,
DERPMap: h.DERPMap,
UserProfiles: profiles,
+ CollectServices: "true",
Debug: &tailcfg.Debug{
DisableLogTail: !h.cfg.LogTail.Enabled,
RandomizeClientPort: h.cfg.RandomizeClientPort,
},```
## Usage
tailscale-prometheus-sd is currently packaged via Nix.
Run with `TAILSCALE_PROMETHEUS_SD_CONFIG=path/to/config.json PROMETHEUS_TARGETS_OUT=path/to/targets.json nix run madjam002/tailscale-prometheus-sd`.
Example config.json:
```
{
"matchers": [
{ "description": "node-exporter" }, // match services collected by description (Tailscale infers this from the process name automatically)
{ "port": 9100 } // match services collected by the port that the service is listening on (9100 is typically used for node-exporter)
]
}
```Services that are matched using `matchers` in the config.json will be written to the Prometheus service discovery file.
## Developing
Make sure Nix is installed, and preferably direnv, otherwise run `nix develop` in this repo to start a development shell.
Then run `TAILSCALE_PROMETHEUS_SD_CONFIG=./config.example.json PROMETHEUS_TARGETS_OUT=./targets.example.json yarn node -r esbuild-register .`
## License
Licensed under the MIT License.
View the full license [here](/LICENSE).