2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/other/wifi_signal

63 lines
1.2 KiB
Plaintext
Raw Normal View History

2006-11-14 19:22:53 +01:00
#!/bin/bash
#
# Show noise and signal levels of wifi enabled devices.
# Author: Nicolai Langfeldt, janl@linprolno
# Modifications: Sebastián Cruz, crux@lugmen.org.ar
# License: GPL v. 2
#
#%# family=auto
#%# capabilitoes=autoconf
PNWL=/proc/net/wireless
do_fetch () {
awk -F'[ :]*' '/:/ {
gsub(/\. /," ",$0); # Remove periods with no decimals after
print $2"_noise.value "$6;
print $2"_signal.value "$5;
}' $PNWL
}
do_config () {
echo "graph_title WiFi signal and noise"
echo "graph_args --base 1000 -u 0"
echo "graph_vlabel dB"
echo "graph_category network"
echo "graph_info This graph shows the noise and singal levels of your WiFi devices"
awk -F'[ :]*' '/:/ {
print $2"_noise.label Noise "$2;
print $2"_signal.label Signal "$2;
}' $PNWL
}
do_autoconf () {
if [ ! -f $PNWL ] ; then
echo "no (no $PNWL)"
exit 1
fi
if [ ! -r $PNWL ] ; then
echo "no (could not read $PNWL)"
exit 1
fi
if grep -qs : $PNWL ; then
echo yes
exit 0
fi
echo "no (no devices in $PNWL)"
exit 1
}
case $1 in
config|autoconf)
eval do_$1
exit 0;;
'')
do_fetch
exit 0;;
esac