Skip to content

Commit 15d9f94

Browse files
wiedehopfkx1t
authored andcommitted
add simple prom file generation script
this is then ingested by docker-telegraf-adsb to provide autogain statistics
1 parent ae7917f commit 15d9f94

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec /scripts/generate-prom.sh
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun

rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/generate-prom

Whitespace-only changes.

rootfs/scripts/generate-prom.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/command/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
# generate prom file for consumption by for example docker-telegraf-adsb
5+
# currently this only has autogain as the other metrics can be generated in docker-telegraf-adsb
6+
7+
OUT=/run/skyaware978/stats.prom
8+
TMP=/run/skyaware978/stats.prom.tmp
9+
10+
function generate() {
11+
if [[ -f "$AUTOGAIN_CURRENT_VALUE_FILE" ]]; then
12+
echo "autogain_current_value=$(cat "$AUTOGAIN_CURRENT_VALUE_FILE")"
13+
echo "autogain_max_value=$(cat "$AUTOGAIN_MAX_GAIN_VALUE_FILE")"
14+
echo "autogain_min_value=$(cat "$AUTOGAIN_MIN_GAIN_VALUE_FILE")"
15+
echo "autogain_pct_strong_messages_max=$AUTOGAIN_PERCENT_STRONG_MESSAGES_MAX"
16+
echo "autogain_pct_strong_messages_min=$AUTOGAIN_PERCENT_STRONG_MESSAGES_MIN"
17+
fi
18+
}
19+
20+
while sleep 60; do
21+
generate > "$TMP"
22+
mv -f "$TMP" "$OUT"
23+
done
24+
25+

0 commit comments

Comments
 (0)