2011-07-31 04:11:14 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
config)
|
|
|
|
cat <<'EOM'
|
|
|
|
graph_order snrdown snrup pwrdown pwrup
|
|
|
|
graph_title dsl stats
|
|
|
|
graph_args --base 1000
|
2017-02-24 03:40:55 +01:00
|
|
|
graph_category network
|
2011-07-31 04:11:14 +02:00
|
|
|
graph_scale no
|
|
|
|
graph_vlabel DSL SNR and Power
|
|
|
|
attndown.label Down Attenuation
|
|
|
|
attndown.type GAUGE
|
|
|
|
attnup.label Up Attenuation
|
|
|
|
attnup.type GAUGE
|
|
|
|
snrdown.label Down SNR
|
|
|
|
snrdown.type GAUGE
|
|
|
|
snrup.label Up SNR
|
|
|
|
snrup.type GAUGE
|
|
|
|
pwrup.label Up Power
|
|
|
|
pwrup.type GAUGE
|
|
|
|
pwrdown.label Down Power
|
|
|
|
pwrdown.type GAUGE
|
|
|
|
pwrdown.cdef pwrdown,10,/
|
|
|
|
pwrup.cdef pwrup,10,/
|
|
|
|
graph_info Graph of DSL Connection Stats
|
|
|
|
EOM
|
|
|
|
exit 0;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
# verify we have the IP for the modem
|
|
|
|
if [[ "$DSLMODEMIP" == "" ]]
|
|
|
|
then
|
|
|
|
echo "DSLMODEMIP variable must be set!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# create temp file for storing wget output
|
|
|
|
TMPFILE=$(mktemp)
|
|
|
|
|
|
|
|
|
2018-08-02 02:03:42 +02:00
|
|
|
# if we have auth variables then add them to
|
2011-07-31 04:11:14 +02:00
|
|
|
# wget cmdline
|
|
|
|
if [[ "$DSLUSER" != "" && "$DSLPASS" != "" ]]
|
|
|
|
then
|
|
|
|
AUTH_OPT="--user=$DSLUSER --password='$DSLPASS' "
|
|
|
|
fi
|
|
|
|
|
|
|
|
# get wan stats page and store it to temp file
|
|
|
|
wget $AUTH_OPT --tries=1 --timeout=10 -q -O $TMPFILE http://$DSLMODEMIP/modemstatus_wanstatus.html
|
|
|
|
# parse the javascript on the page to get the info we need and print it
|
|
|
|
cat $TMPFILE | grep 'dslstatus = '| sed -e "s/['; ]//g" | head -n 1 | awk -F '[|/]' '{print "snrdown.value "$5"\nsnrup.value "$6"\nattndown.value "$7"\nattnup.value "$8"\npwrup.value "$29"\npwrdown.value "$30}'
|
|
|
|
|
|
|
|
#remove temp file
|
|
|
|
rm $TMPFILE
|