From 7cb27ea6207c8c7ef384a558e452c98a71ede9c2 Mon Sep 17 00:00:00 2001 From: "andrea.noni" Date: Tue, 19 Mar 2024 21:35:17 +0100 Subject: [PATCH] added openwrt wifi status --- openwrt_wifi_up.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 openwrt_wifi_up.sh diff --git a/openwrt_wifi_up.sh b/openwrt_wifi_up.sh new file mode 100755 index 0000000..9d39c2b --- /dev/null +++ b/openwrt_wifi_up.sh @@ -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 +