#!/bin/sh
# 
# 
# Script to the signal strength of a Open GlobeSurfer II 3G router. 
#
# Parameters understood:
#
# 	config   (required)
# 	autoconf (optional - used by munin-config)
#
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
MAXLABEL=20

if [ "$1" = "autoconf" ]; then
	echo yes
	exit 0
fi

if [ "$1" = "config" ]; then

	echo 'graph_title GlobeSurfer II Signal Strength'
	echo 'graph_args --base 1000 -l 0'
	echo 'graph_vlabel Daily Statistics'
	echo 'signal_strength.label Signal Strength'
	exit 0
fi

wget -q http://192.168.1.1 -O /tmp/index.html
grep "dBm" /tmp/index.html | perl -ne 'if (/(-\d+) dBm/) {print "-en signal_strength.value ".$1}'; 
rm /tmp/index.html
