From efff944f7f2cc5ff9a4d201bc22b24cc382803a3 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sun, 24 Nov 2013 20:34:55 +0100 Subject: [PATCH 1/6] dartybox: initial add --- plugins/network/dartybox | 107 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100755 plugins/network/dartybox diff --git a/plugins/network/dartybox b/plugins/network/dartybox new file mode 100755 index 00000000..c7607b45 --- /dev/null +++ b/plugins/network/dartybox @@ -0,0 +1,107 @@ +#! /bin/sh +# Parse box information +# +# configuration : +# +# [dartybox] +# env.IP 192.168.1.254 + +# 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 + echo up.label UpStream + echo down.label DownStream + echo multigraph dbox_adsl_att + echo graph_title DartyBox Adsl Attenuation + echo up.label UpStream + echo down.value DownStream + echo multigraph dbox_adsl_snr + echo graph_title DartyBox Adsl SignalNoise Ratio + echo up.label SNRNear + echo down.label SNRFar + echo multigraph dbox_adsl_pkt + echo graph_title DartyBox Adsl Packets + echo up.label RSWORDSNear + echo down.label RSWORDSFar + echo up_c.label RSCORRERRORNear + echo down_c.label RSCORRERRORFar + echo up_u.label RSUNCORRERRORNear + echo down_u.label RSUNCORRERRORFar + echo multigraph dbox_adsl_uptime + echo graph_title DartyBox Adsl Uptime + echo uptime.label AdslUpTime + + exit 0 +fi + +TMPFILE=$(mktemp) +trap 'rm -f $TMPFILE' EXIT + +wget -qO "$TMPFILE" http://$IP/adslstats.html + +get() { + PATTERN=$1 + gawk "match(\$0, /var $PATTERN\s+=\s+\"([0-9.]+)\"/, a) { print a[1] }" $TMPFILE +} + +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 +echo uptime.value $(get AdslUpTime) + +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 From 6994dcd17dd6c6565ec4a94447e2133f1c2c005c Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sat, 30 Nov 2013 16:23:25 +0100 Subject: [PATCH 2/6] dartybox: adding multigraph nice behavior --- plugins/network/dartybox | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/network/dartybox b/plugins/network/dartybox index c7607b45..63ef45bc 100755 --- a/plugins/network/dartybox +++ b/plugins/network/dartybox @@ -6,6 +6,11 @@ # [dartybox] # env.IP 192.168.1.254 + +. $MUNIN_LIBDIR/plugins/plugin.sh + +is_multigraph + # fail on error set -e From 0cf1fbbe9ea824610702322e9032998c0c089443 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sat, 30 Nov 2013 16:23:54 +0100 Subject: [PATCH 3/6] dartybox: fix the dirtyconfig behavior --- plugins/network/dartybox | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/network/dartybox b/plugins/network/dartybox index 63ef45bc..36282735 100755 --- a/plugins/network/dartybox +++ b/plugins/network/dartybox @@ -20,18 +20,22 @@ if [ "$1" = "config" ] then echo multigraph dbox_adsl_bw echo graph_title DartyBox Adsl Bandwith + echo graph_category DartyBox echo up.label UpStream echo down.label DownStream echo multigraph dbox_adsl_att echo graph_title DartyBox Adsl Attenuation + echo graph_category DartyBox echo up.label UpStream - echo down.value DownStream + echo down.label DownStream echo multigraph dbox_adsl_snr echo graph_title DartyBox Adsl SignalNoise Ratio + echo graph_category DartyBox echo up.label SNRNear echo down.label SNRFar echo multigraph dbox_adsl_pkt echo graph_title DartyBox Adsl Packets + echo graph_category DartyBox echo up.label RSWORDSNear echo down.label RSWORDSFar echo up_c.label RSCORRERRORNear @@ -40,6 +44,7 @@ then echo down_u.label RSUNCORRERRORFar echo multigraph dbox_adsl_uptime echo graph_title DartyBox Adsl Uptime + echo graph_category DartyBox echo uptime.label AdslUpTime exit 0 From 9eeaa5266245b18cd63f6e89ebdfe2dfdf7113d4 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sat, 30 Nov 2013 16:27:10 +0100 Subject: [PATCH 4/6] dartybox: using DERIVE for packets counts --- plugins/network/dartybox | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/network/dartybox b/plugins/network/dartybox index 36282735..6ed9dbfd 100755 --- a/plugins/network/dartybox +++ b/plugins/network/dartybox @@ -42,6 +42,18 @@ then echo down_c.label RSCORRERRORFar echo up_u.label RSUNCORRERRORNear echo down_u.label RSUNCORRERRORFar + 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 echo multigraph dbox_adsl_uptime echo graph_title DartyBox Adsl Uptime echo graph_category DartyBox From 25722e7857a68014cc3e25c845a435de566368b3 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Fri, 6 Dec 2013 20:57:56 +0100 Subject: [PATCH 5/6] dartybox: fix the date & labels --- plugins/network/dartybox | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/plugins/network/dartybox b/plugins/network/dartybox index 6ed9dbfd..55e4e9d6 100755 --- a/plugins/network/dartybox +++ b/plugins/network/dartybox @@ -31,17 +31,17 @@ then echo multigraph dbox_adsl_snr echo graph_title DartyBox Adsl SignalNoise Ratio echo graph_category DartyBox - echo up.label SNRNear - echo down.label SNRFar + echo up.label UpStream + echo down.label DownStream echo multigraph dbox_adsl_pkt echo graph_title DartyBox Adsl Packets echo graph_category DartyBox - echo up.label RSWORDSNear - echo down.label RSWORDSFar - echo up_c.label RSCORRERRORNear - echo down_c.label RSCORRERRORFar - echo up_u.label RSUNCORRERRORNear - echo down_u.label RSUNCORRERRORFar + 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)" echo up.type DERIVE echo down.type DERIVE echo up_c.type DERIVE @@ -57,7 +57,8 @@ then echo multigraph dbox_adsl_uptime echo graph_title DartyBox Adsl Uptime echo graph_category DartyBox - echo uptime.label AdslUpTime + echo graph_vlabel days + echo uptime.label Uptime exit 0 fi @@ -67,9 +68,16 @@ trap 'rm -f $TMPFILE' EXIT wget -qO "$TMPFILE" http://$IP/adslstats.html +[ "$MUNIN_DEBUG" = 1 ] && cat "$TMPFILE" + get() { PATTERN=$1 - gawk "match(\$0, /var $PATTERN\s+=\s+\"([0-9.]+)\"/, a) { print a[1] }" $TMPFILE + 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 }" } echo multigraph dbox_adsl_bw @@ -89,7 +97,7 @@ echo down_c.value $(get RSCORRERRORFar) echo up_u.value $(get RSUNCORRERRORNear) echo down_u.value $(get RSUNCORRERRORFar) echo multigraph dbox_adsl_uptime -echo uptime.value $(get AdslUpTime) +echo uptime.value $(getDays $(get AdslUpTime)) exit 0 From 150f0188584569beea926717d569995b451d2e62 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sat, 7 Dec 2013 15:21:59 +0100 Subject: [PATCH 6/6] p/dartybox: adding a license --- plugins/network/dartybox | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/network/dartybox b/plugins/network/dartybox index 55e4e9d6..f588548a 100755 --- a/plugins/network/dartybox +++ b/plugins/network/dartybox @@ -1,7 +1,8 @@ #! /bin/sh # Parse box information +# (c) 2013 - GPLv2 - Steve Schnepp # -# configuration : +# Configuration is done via ENV vars, here is the default : # # [dartybox] # env.IP 192.168.1.254