2013-11-24 20:34:55 +01:00
|
|
|
#! /bin/sh
|
|
|
|
# Parse box information
|
2013-12-07 15:21:59 +01:00
|
|
|
# (c) 2013 - GPLv2 - Steve Schnepp <steve.schnepp@pwkf.org>
|
2013-11-24 20:34:55 +01:00
|
|
|
#
|
2013-12-07 15:21:59 +01:00
|
|
|
# Configuration is done via ENV vars, here is the default :
|
2013-11-24 20:34:55 +01:00
|
|
|
#
|
|
|
|
# [dartybox]
|
|
|
|
# env.IP 192.168.1.254
|
|
|
|
|
2013-11-30 16:23:25 +01:00
|
|
|
|
|
|
|
. $MUNIN_LIBDIR/plugins/plugin.sh
|
|
|
|
|
|
|
|
is_multigraph
|
|
|
|
|
2013-11-24 20:34:55 +01:00
|
|
|
# fail on error
|
|
|
|
set -e
|
|
|
|
|
|
|
|
IP=${IP:-"192.168.1.254"}
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]
|
|
|
|
then
|
|
|
|
echo multigraph dbox_adsl_bw
|
|
|
|
echo graph_title DartyBox Adsl Bandwith
|
2013-11-30 16:23:54 +01:00
|
|
|
echo graph_category DartyBox
|
2013-11-24 20:34:55 +01:00
|
|
|
echo up.label UpStream
|
|
|
|
echo down.label DownStream
|
|
|
|
echo multigraph dbox_adsl_att
|
|
|
|
echo graph_title DartyBox Adsl Attenuation
|
2013-11-30 16:23:54 +01:00
|
|
|
echo graph_category DartyBox
|
2013-11-24 20:34:55 +01:00
|
|
|
echo up.label UpStream
|
2013-11-30 16:23:54 +01:00
|
|
|
echo down.label DownStream
|
2013-11-24 20:34:55 +01:00
|
|
|
echo multigraph dbox_adsl_snr
|
|
|
|
echo graph_title DartyBox Adsl SignalNoise Ratio
|
2013-11-30 16:23:54 +01:00
|
|
|
echo graph_category DartyBox
|
2013-12-06 20:57:56 +01:00
|
|
|
echo up.label UpStream
|
|
|
|
echo down.label DownStream
|
2013-11-24 20:34:55 +01:00
|
|
|
echo multigraph dbox_adsl_pkt
|
|
|
|
echo graph_title DartyBox Adsl Packets
|
2013-11-30 16:23:54 +01:00
|
|
|
echo graph_category DartyBox
|
2013-12-06 20:57:56 +01:00
|
|
|
echo up.label UpStream
|
|
|
|
echo down.label DownStream
|
|
|
|
echo up_c.label UpStream "(Correctable)"
|
|
|
|
echo down_c.label DownStream "(Correctable)"
|
|
|
|
echo up_u.label UpStream "(Uncorrectable)"
|
|
|
|
echo down_u.label DownStream "(Uncorrectable)"
|
2013-11-30 16:27:10 +01:00
|
|
|
echo up.type DERIVE
|
|
|
|
echo down.type DERIVE
|
|
|
|
echo up_c.type DERIVE
|
|
|
|
echo down_c.type DERIVE
|
|
|
|
echo up_u.type DERIVE
|
|
|
|
echo down_u.type DERIVE
|
|
|
|
echo up.min 0
|
|
|
|
echo down.min 0
|
|
|
|
echo up_c.min 0
|
|
|
|
echo down_c.min 0
|
|
|
|
echo up_u.min 0
|
|
|
|
echo down_u.min 0
|
2013-11-24 20:34:55 +01:00
|
|
|
echo multigraph dbox_adsl_uptime
|
|
|
|
echo graph_title DartyBox Adsl Uptime
|
2013-11-30 16:23:54 +01:00
|
|
|
echo graph_category DartyBox
|
2013-12-06 20:57:56 +01:00
|
|
|
echo graph_vlabel days
|
|
|
|
echo uptime.label Uptime
|
2013-11-24 20:34:55 +01:00
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
TMPFILE=$(mktemp)
|
|
|
|
trap 'rm -f $TMPFILE' EXIT
|
|
|
|
|
|
|
|
wget -qO "$TMPFILE" http://$IP/adslstats.html
|
|
|
|
|
2013-12-06 20:57:56 +01:00
|
|
|
[ "$MUNIN_DEBUG" = 1 ] && cat "$TMPFILE"
|
|
|
|
|
2013-11-24 20:34:55 +01:00
|
|
|
get() {
|
|
|
|
PATTERN=$1
|
2013-12-06 20:57:56 +01:00
|
|
|
gawk "match(\$0, /var $PATTERN\s+=\s+\"([^\"]+)\"/, a) { print a[1] }" $TMPFILE
|
|
|
|
}
|
|
|
|
|
|
|
|
getDays() {
|
|
|
|
# Convert "20 jours 2 heures 2 mn" in a number of days
|
|
|
|
echo "$@" | gawk "match(\$0, /([0-9.]+) jours ([0-9.]+) heures ([0-9.]+) mn/, a) { print a[1] + a[2]/24 + a[3]/1440 }"
|
2013-11-24 20:34:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
echo multigraph dbox_adsl_bw
|
|
|
|
echo up.value $(get UpStream)
|
|
|
|
echo down.value $(get DownStream)
|
|
|
|
echo multigraph dbox_adsl_att
|
|
|
|
echo up.value $(get AttNear)
|
|
|
|
echo down.value $(get AttFar)
|
|
|
|
echo multigraph dbox_adsl_snr
|
|
|
|
echo up.value $(get SNRNear)
|
|
|
|
echo down.value $(get SNRFar)
|
|
|
|
echo multigraph dbox_adsl_pkt
|
|
|
|
echo up.value $(get RSWORDSNear)
|
|
|
|
echo down.value $(get RSWORDSFar)
|
|
|
|
echo up_c.value $(get RSCORRERRORNear)
|
|
|
|
echo down_c.value $(get RSCORRERRORFar)
|
|
|
|
echo up_u.value $(get RSUNCORRERRORNear)
|
|
|
|
echo down_u.value $(get RSUNCORRERRORFar)
|
|
|
|
echo multigraph dbox_adsl_uptime
|
2013-12-06 20:57:56 +01:00
|
|
|
echo uptime.value $(getDays $(get AdslUpTime))
|
2013-11-24 20:34:55 +01:00
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
:<<'EOF'
|
|
|
|
var ADSLLineStatus = "Etabli";
|
|
|
|
var ADSLMode = "G992_1_A (G.DMT) ";
|
|
|
|
var UpStream = "704";
|
|
|
|
var DownStream = "7616";
|
|
|
|
var AttNear = "33.5";
|
|
|
|
var AttFar = "16.5";
|
|
|
|
var SNRNear = "11.0";
|
|
|
|
var SNRFar = "15.0";
|
|
|
|
var HECCountNear= "4836";
|
|
|
|
var HECCountFar= "6";
|
|
|
|
var AdslVer1 = "0x81ef5379";
|
|
|
|
var AdslVer2 = "0x6397bde2";
|
|
|
|
var CmvVer1 = "0x6f249e71";
|
|
|
|
var CmvVer2 = "0xa703362e";
|
|
|
|
var ES15CntNear = "0";
|
|
|
|
var ES15CntFar = "0";
|
|
|
|
var CRCErrorsNear = "641";
|
|
|
|
var CRCErrorsFar = "7";
|
|
|
|
var ES1CNTNear = "8";
|
|
|
|
var ES1CNTFar = "0";
|
|
|
|
|
|
|
|
var ESTOTCNTFar = "5";
|
|
|
|
var ESTOTCNTNear = "452";
|
|
|
|
var RSWORDSNear = "1802451823";
|
|
|
|
var RSWORDSFar = "2881437753";
|
|
|
|
var RSCORRERRORNear = "57293";
|
|
|
|
var RSCORRERRORFar = "301";
|
|
|
|
var RSUNCORRERRORNear = "641";
|
|
|
|
var RSUNCORRERRORFar = "7";
|
|
|
|
var RSRatioNear = "0";
|
|
|
|
var RSRatioFar = "0";
|
|
|
|
var AdslUpTime = "20 jours 2 heures 2 mn";
|
|
|
|
EOF
|