1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-08-03 22:58:20 +00:00

move api check

This commit is contained in:
Michael Grote 2023-03-02 22:57:29 +01:00
parent 35f8104175
commit 3426abebf2
2 changed files with 6 additions and 6 deletions

View file

@ -63,9 +63,6 @@ export SLRM_DATA_REQUEST_BODY=$(jq --null-input --arg deviceSn "${SLRM_DEVICE_SN
## get panel data ## get panel data
export SLRM_DATA=$(curl --silent --request POST --url "https://api.solarmanpv.com/device/v1.0/currentData?appId=${SLRM_APPID}&language=en&=" --header "Authorization: bearer ${SLRM_BEARER_TOKEN}" --header 'Content-Type: application/json' --data "${SLRM_DATA_REQUEST_BODY}") export SLRM_DATA=$(curl --silent --request POST --url "https://api.solarmanpv.com/device/v1.0/currentData?appId=${SLRM_APPID}&language=en&=" --header "Authorization: bearer ${SLRM_BEARER_TOKEN}" --header 'Content-Type: application/json' --data "${SLRM_DATA_REQUEST_BODY}")
# sometimes the api can not find the requested device, exit here
echo $SLRM_DATA | grep "device not found" && exit 1
# wenn parameter = ... # wenn parameter = ...
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
@ -119,6 +116,9 @@ if [ "$1" = "config" ]; then
exit 0 exit 0
fi fi
# sometimes the api can not find the requested device, exit here
echo $SLRM_DATA | grep "device not found" && exit 1
echo "multigraph production_total" echo "multigraph production_total"
echo total_inverter.value "$(echo "$SLRM_DATA" | jq -r '.dataList[]|select(.key|IN("Et_ge0"))|.value')" echo total_inverter.value "$(echo "$SLRM_DATA" | jq -r '.dataList[]|select(.key|IN("Et_ge0"))|.value')"
echo total_panel1.value "$(echo "$SLRM_DATA" | jq -r '.dataList[]|select(.key|IN("Et_ge1"))|.value')" echo total_panel1.value "$(echo "$SLRM_DATA" | jq -r '.dataList[]|select(.key|IN("Et_ge1"))|.value')"

View file

@ -63,9 +63,6 @@ export SLRM_DATA_REQUEST_BODY=$(jq --null-input --arg deviceSn "${SLRM_DEVICE_SN
## get panel data ## get panel data
export SLRM_DATA=$(curl --silent --request POST --url "https://api.solarmanpv.com/device/v1.0/currentData?appId=${SLRM_APPID}&language=en&=" --header "Authorization: bearer ${SLRM_BEARER_TOKEN}" --header 'Content-Type: application/json' --data "${SLRM_DATA_REQUEST_BODY}") export SLRM_DATA=$(curl --silent --request POST --url "https://api.solarmanpv.com/device/v1.0/currentData?appId=${SLRM_APPID}&language=en&=" --header "Authorization: bearer ${SLRM_BEARER_TOKEN}" --header 'Content-Type: application/json' --data "${SLRM_DATA_REQUEST_BODY}")
# sometimes the api can not find the requested device, exit here
echo $SLRM_DATA | grep "device not found" && exit 1
# wenn parameter = ... # wenn parameter = ...
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
@ -96,6 +93,9 @@ if [ "$1" = "config" ]; then
exit 0 exit 0
fi fi
# sometimes the api can not find the requested device, exit here
echo $SLRM_DATA | grep "device not found" && exit 1
echo multigraph voltage_current_input echo multigraph voltage_current_input
echo voltage.value "$(echo "$SLRM_DATA" | jq -r '.dataList[]|select(.key|IN("DV1"))|.value')" echo voltage.value "$(echo "$SLRM_DATA" | jq -r '.dataList[]|select(.key|IN("DV1"))|.value')"
echo current.value "$(echo "$SLRM_DATA" | jq -r '.dataList[]|select(.key|IN("DC1"))|.value')" echo current.value "$(echo "$SLRM_DATA" | jq -r '.dataList[]|select(.key|IN("DC1"))|.value')"