mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Plugin-Gallery: Better 2nd level headings
This commit is contained in:
parent
ae4e85ab60
commit
e10e386b02
10 changed files with 7 additions and 2 deletions
48
plugins/router/dsl-connection-speed
Executable file
48
plugins/router/dsl-connection-speed
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
cat <<'EOM'
|
||||
graph_order downspeed upspeed
|
||||
graph_title DSL Connection Speed
|
||||
graph_args --base 1000 -l 1000 --upper-limit 42000
|
||||
graph_category network
|
||||
graph_scale no
|
||||
graph_vlabel DSL up / down speed
|
||||
downspeed.label Down speed
|
||||
downspeed.type GAUGE
|
||||
upspeed.label Up speed
|
||||
upspeed.type GAUGE
|
||||
graph_info Graph of DSL Connection Speed
|
||||
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)
|
||||
|
||||
# if we have auth variables then add them to
|
||||
# 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 tempfile to get connection speeds
|
||||
DOWNRATE=$(cat $TMPFILE | grep downrate= | sed -e "s/var.*downrate='\(.*\)';.*/\1/g" | sed -e 's/\s//g' | tail -n 1)
|
||||
UPRATE=$(cat $TMPFILE | grep uprate= | sed -e "s/var.*uprate='\(.*\)';.*/\1/g" | sed -e 's/\s//g' | tail -n 1)
|
||||
# done with the temp file, remove
|
||||
rm $TMPFILE
|
||||
|
||||
# done, output speeds
|
||||
echo "upspeed.value $UPRATE"
|
||||
echo "downspeed.value $DOWNRATE"
|
Loading…
Add table
Add a link
Reference in a new issue