init
This commit is contained in:
29
check_wifi_stations.sh
Executable file
29
check_wifi_stations.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
WWW_PATH="/cgi-bin/stations"
|
||||
|
||||
while getopts ":p:h:" opt; do
|
||||
case $opt in
|
||||
p)
|
||||
WWW_PATH="$OPTARG"
|
||||
;;
|
||||
h)
|
||||
HOST="$OPTARG"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
OUTPUT="UNKNOWN: Script failed"
|
||||
EXIT_CODE=3
|
||||
|
||||
stations=$(curl -s http://$HOST$WWW_PATH | wc -l)
|
||||
VALUE="|Stations=$stations"
|
||||
OUTPUT="OK: $stations Stations"
|
||||
EXIT_CODE=0
|
||||
|
||||
echo "$OUTPUT" "$VALUE"
|
||||
exit $EXIT_CODE
|
||||
Reference in New Issue
Block a user