#!/bin/sh # Push skyweave metrics to Prometheus pushgateway every 30 seconds. # PUT (not POST) so the whole group is replaced each cycle — per-client # series for departed stations don't linger. Skips the push if the local # metrics fetch fails, so a CGI hiccup never blanks the group. PUSHGW="http://192.168.88.44:9091/metrics/job/rvlink/instance/rvlink" METRICS_URL="http://127.0.0.1:42069/cgi-bin/skyweave.lua/metrics" while true; do BODY=$(curl -sf "$METRICS_URL") if [ -n "$BODY" ]; then printf '%s\n' "$BODY" | curl -sf -X PUT --data-binary @- "$PUSHGW" >/dev/null 2>&1 fi sleep 30 done