From 3e71f1de8d18c7b034ff5816a4784b62a34bfca3 Mon Sep 17 00:00:00 2001 From: CruX Date: Tue, 14 Nov 2006 19:22:53 +0100 Subject: [PATCH] Initial version --- plugins/other/wifi_signal | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 plugins/other/wifi_signal diff --git a/plugins/other/wifi_signal b/plugins/other/wifi_signal new file mode 100755 index 00000000..7892cbe5 --- /dev/null +++ b/plugins/other/wifi_signal @@ -0,0 +1,62 @@ +#!/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 +