Layer3: Remove alfred

We don't need alfred on layer3 variante and remove it here
We save the nodewatcher Data on /tmp/nodewatcher and send this data
with mqtt und direct to the monitoring

fix: #120

Signed-off-by: Christian Dresel <freifunk@dresel.systems>
This commit is contained in:
Christian Dresel 2022-02-28 08:30:34 +01:00
parent 27baecaf37
commit e9ca5477f3
3 changed files with 8 additions and 3 deletions

View File

@ -3,5 +3,5 @@
api_url="https://monitoring.freifunk-franken.de/api/alfred2"
fetch_id="64"
/bin/alfred-json -r "$fetch_id" | \
cat /tmp/nodewatcher | \
/usr/bin/curl -k -sS -H "Content-type: application/json; charset=UTF-8" --data-binary @- "$api_url"

View File

@ -3,6 +3,6 @@ MACADDR=$(cat /sys/class/net/br-client/address | /bin/sed 's/://g')
fetch_id="64"
if [ -n "$(uci -q get fff.mqtt.server)" ] ; then
mosquitto_pub -h "$(uci get fff.mqtt.server)" -p 1883 -t /monitoring/v1/$MACADDR -m "$(/bin/alfred-json -r "$fetch_id")"
mosquitto_pub -h "$(uci get fff.mqtt.server)" -p 1883 -t /monitoring/v1/$MACADDR -m "$(cat /tmp/nodewatcher)"
fi

View File

@ -43,7 +43,12 @@ crawl() {
#write data to xml file that provides the data on httpd
SCRIPT_DATA_DIR=$(dirname "$SCRIPT_DATA_FILE")
test -d "$SCRIPT_DATA_DIR" || mkdir -p "$SCRIPT_DATA_DIR"
echo "$DATA" | gzip | tee "$SCRIPT_DATA_FILE" | alfred -s 64
if alfred then
echo "$DATA" | gzip | tee "$SCRIPT_DATA_FILE" | alfred -s 64
elfi
echo "$DATA" > /tmp/nodewatcher
fi
}
LANG=C