Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/generate-prom/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec /scripts/generate-prom.sh
1 change: 1 addition & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/generate-prom/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
25 changes: 25 additions & 0 deletions rootfs/scripts/generate-prom.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/command/with-contenv bash
# shellcheck shell=bash

# generate prom file for consumption by for example docker-telegraf-adsb
# currently this only has autogain as the other metrics can be generated in docker-telegraf-adsb

OUT=/run/skyaware978/stats.prom
TMP=/run/skyaware978/stats.prom.tmp

function generate() {
if [[ -f "$AUTOGAIN_CURRENT_VALUE_FILE" ]]; then
echo "autogain_current_value=$(cat "$AUTOGAIN_CURRENT_VALUE_FILE")"
echo "autogain_max_value=$(cat "$AUTOGAIN_MAX_GAIN_VALUE_FILE")"
echo "autogain_min_value=$(cat "$AUTOGAIN_MIN_GAIN_VALUE_FILE")"
echo "autogain_pct_strong_messages_max=$AUTOGAIN_PERCENT_STRONG_MESSAGES_MAX"
echo "autogain_pct_strong_messages_min=$AUTOGAIN_PERCENT_STRONG_MESSAGES_MIN"
fi
}

while sleep 60; do
generate > "$TMP"
mv -f "$TMP" "$OUT"
done


Loading