Commit c629680e authored by ='s avatar =
Browse files

add check_wifi

parent 727c6385
#!/bin/bash
DEV=
WARN=10
CRITICAL=0
EXIT=3
while getopts ":c:i:w:" opt; do
case $opt in
c)
CRITICAL=$OPTARG
;;
i)
DEV=$OPTARG
;;
w)
WARN=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
if [ -z "$DEV" ]; then
echo "no interface given"
exit $EXIT
fi
STATS=($( grep $DEV: /proc/net/wireless | sed -e 's/[\.:]//g' )) #awk '{ print $3 "0 " $4 "0 " $5 "0"} '))
if [ -z "$STATS" ]; then
echo "$DEV is not a wireless interface"
exit $EXIT
fi
if (( $(echo "${STATS[2]} <= $CRITICAL" |bc -l) )); then
echo -n "CRITICAL $DEV link is down"
EXIT=2
elif (( $(echo "${STATS[2]} <= $WARN" |bc -l) )); then
echo -n "WARNING $DEV link is weak"
EXIT=1
else
echo -n "OK $DEV"
EXIT=0
fi
echo " - Quality: ${STATS[2]}/70 Signal: ${STATS[3]} dBm Noise: ${STATS[4]} dBm | quality=${STATS[2]};signal=${STATS[3]};noise=${STATS[4]}"
exit $EXIT
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment