added openwrt wifi status

This commit is contained in:
andrea.noni 2024-03-19 21:35:17 +01:00
parent 10d44f9234
commit 7cb27ea620
1 changed files with 21 additions and 0 deletions

21
openwrt_wifi_up.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
## dependencies: curl
### This script checks if the 2 wifi interfaces are UP and ENABLED
HOST="$(cat system | grep "hostname")"
topicurl=https://172.26.0.15/net_alerts
RADIO_STATUS=$(wifi status | grep -c "\"up\": true")
DEVICE_STATUS=$(wifi status | grep -c "\"disabled\": false")
if [ ${RADIO_STATUS} != 2 ] || [ ${DEVICE_STATUS} != 2 ] ; then
curl -k --retry 3 \
-d "wifi down in $HOST" \
-H "Title: Wifi down in $HOST" \
-H "Priority: high" \
-H "Tags: warning,boar" \
$topicurl
fi