#!/bin/bash

######################################
# GDS ePanel: neue Schwellwerte setzen
# Wird von httpr.sh getriggert
######################################


# Prüfen, welches Display angeschlossen ist
DTYPE="$(/home/snowtv/bin/dtype.sh)"
if [ "$DTYPE" != "gds" ]; then
	exit	
fi


ID="$(/home/snowtv/bin/getid.sh)"
TOK="$(cat /home/snowtv/bin/token)"
DOMAIN="$(/home/snowtv/bin/getdomain.sh | tr -d "[']")"
CFG="$(curl -k --connect-timeout 20 --max-time 40 -s \
    -H "APG-Authorization: $TOK" "${DOMAIN}/apg-mp?device=${ID}" \
    --user-agent "apg-mp" | jq -r ".cfgGDS")"

snmpset localhost $CFG

exit 0
