Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prometheus stuff #243

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -756,7 +756,6 @@ In order for Telegraf to serve a [Prometheus](https://prometheus.io) endpoint, t
| Variable | Description |
| ------------------- | ------------------------------------------------------------------------ |
| `PROMETHEUS_ENABLE` | Set to `true` for a Prometheus endpoint on `http://0.0.0.0:9273/metrics` |
| `PROMETHEUSPORT` | TCP port for the Prometheus endpoint. Default value is 9273 |

## Minimalist setup

27 changes: 27 additions & 0 deletions rootfs/etc/s6-overlay/startup.d/99-prometheus-conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/command/with-contenv bash
#shellcheck shell=bash disable=SC1091

source /scripts/common

if ! chk_enabled "$PROMETHEUS_ENABLE"; then
exit 0
fi

# serve port 9274 always replying with stats.prom regardless of requested path

cat > /etc/nginx/sites-enabled/prometheus_9274 <<EOF
server {
listen 9274 default_server;
root /var/www/html;
server_name _;
location /metrics {
default_type text/plain;
alias /run/readsb/stats.prom;
}
location / {
default_type text/plain;
alias /run/readsb/stats.prom;
rewrite (.*) /metrics last;
}
}
EOF