mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 09:57:09 +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
|
@ -1,132 +0,0 @@
|
|||
#!/usr/bin/ruby
|
||||
# munin plugin to retrieve connection statistics from the web admin interface
|
||||
# on a Linksys AG241v2 ADSL modem
|
||||
# Makes use of the http://modemaddress/ADSLCStatus.htm page
|
||||
|
||||
#This plugin has only been tested on a Debian testing system
|
||||
|
||||
# This modem also has some basic SNMP support so you can configure it
|
||||
# as per the instructions on the munin wiki
|
||||
# http://munin.projects.linpro.no/wiki/Using_SNMP_plugins
|
||||
# By default the SNMP server is disabled, you can enable it in the web admin
|
||||
# You will need to set up the "virtual node" configuration as detailed
|
||||
# for snmp plugins
|
||||
|
||||
# Plugin will require some configuration in /etc/munin/plugin-conf.d/ag241_MODEMADDRESS
|
||||
# e.g.
|
||||
# [ag241_vocume.stargate_*]
|
||||
# env.user admin
|
||||
# env.pass password
|
||||
# #env.port 80
|
||||
|
||||
# Once you have the above config set you will need to symlink the plugin to
|
||||
# /etc/munin/plugins/ag241_MODEMADDRESS_syncrate
|
||||
# /etc/munin/plugins/ag241_MODEMADDRESS_attenutation
|
||||
# /etc/munin/plugins/ag241_MODEMADDRESS_noise
|
||||
# now restart munin-node.
|
||||
# hopefully in 20-30mins you will have some nice graphs
|
||||
|
||||
|
||||
#Some magical munin foo...
|
||||
#%# family=manual
|
||||
#%# capabilities=
|
||||
|
||||
# Require this module, it is part of the standard ruby lib AFAIK
|
||||
require 'net/http'
|
||||
|
||||
#default parameters
|
||||
host = nil
|
||||
port = ENV['port'] || 80
|
||||
user = ENV['user'] || 'admin'
|
||||
pass = ENV['pass'] || 'forhax' #dont remember what the default admin password was
|
||||
stat = nil
|
||||
|
||||
# Check executeable "name" for parameter count
|
||||
params = $0.split('_')
|
||||
if params.size != 3
|
||||
puts "Incorrect number of parameters"
|
||||
exit 1
|
||||
end
|
||||
|
||||
# first param after the plugin name is the host to query
|
||||
# second is the statistic to query
|
||||
host = params[1]
|
||||
stat = params[2]
|
||||
|
||||
unless ENV['debug'].nil?
|
||||
puts "user = "+ user
|
||||
puts "pass = "+ pass
|
||||
puts "host = "+ host
|
||||
puts "port = "+ port
|
||||
puts "stat = "+ stat
|
||||
end
|
||||
|
||||
# Dump the graph configuration data
|
||||
if ARGV[0] == 'config'
|
||||
puts 'host_name ' + host
|
||||
puts 'graph_category network'
|
||||
|
||||
case stat
|
||||
when 'syncrate'
|
||||
puts 'graph_info This graph shows the ADSL line sync rate.'
|
||||
puts 'graph_title ADSL line sync rate'
|
||||
puts 'graph_vlabel connection rate bits / second'
|
||||
puts 'graph_args --base 1000 -l 0 '
|
||||
when 'attenuation'
|
||||
puts 'graph_info This graph shows the ADSL line attenuation.'
|
||||
puts 'graph_title ADSL line attenuation'
|
||||
puts 'graph_vlabel attenuation dB'
|
||||
when 'margin','noise'
|
||||
puts 'graph_info This graph shows the ADSL SNR margin.'
|
||||
puts 'graph_title ADSL line SNR margin'
|
||||
puts 'graph_vlabel noise margin dB'
|
||||
end
|
||||
puts 'down.label downstream'
|
||||
puts 'up.label upstream'
|
||||
exit 0
|
||||
end
|
||||
|
||||
# Connect to the webadmin
|
||||
http = Net::HTTP.start(host,port)
|
||||
req = Net::HTTP::Get.new('/ADSLCStatus.htm')
|
||||
# send the login info
|
||||
req.basic_auth user, pass
|
||||
response = http.request(req)
|
||||
s = response.body
|
||||
|
||||
#Make sure we got the page successfully
|
||||
if response.code != '200'
|
||||
puts "Getting web page failed:"
|
||||
case response.code
|
||||
when '401'
|
||||
puts 'Probably because the username and password are incorrect'
|
||||
#Looks like the modem respons with 200 when you try to access a page that doesnt exist >_>
|
||||
#when '404'
|
||||
# puts 'Looks like the page this plugin needs isn\'t available...'
|
||||
# puts 'Check your modem make/model/version'
|
||||
end
|
||||
puts s
|
||||
exit 1
|
||||
end
|
||||
|
||||
# Apply voodoo regex to the result HTML to get the data we want.
|
||||
case stat
|
||||
when 'syncrate'
|
||||
a = s.scan(/.*share\.curstate.*\n.*share\.downstr[^0-9]*([0-9]+).*share\.upstr[^0-9]*([0-9]+).*$/)
|
||||
b,c = a[0]
|
||||
puts 'down.value '+ (b.to_i*1000).to_s + "\n" + 'up.value '+ (c.to_i*1000).to_s
|
||||
exit 0
|
||||
when 'attenuation'
|
||||
a = s.scan(/.*share\.lineatt.*\n.*share\.down[^0-9]*([0-9]+).*share\.up[^0-9]*([0-9]+).*$/)
|
||||
b,c = a[0]
|
||||
puts 'down.value '+ (b.to_i).to_s + "\n" + 'up.value '+ (c.to_i).to_s
|
||||
exit 0
|
||||
when 'margin','noise'
|
||||
a = s.scan(/.*share\.noise.*\n.*share\.down[^0-9]*([0-9]+).*share\.up[^0-9]*([0-9]+).*$/)
|
||||
b,c = a[0]
|
||||
puts 'down.value '+ (b.to_i).to_s + "\n" + 'up.value '+ (c.to_i).to_s
|
||||
exit 0
|
||||
else
|
||||
puts 'Statistic ' + stat.to_s + ' not known, would you like me to fabricate it for you?'
|
||||
exit 1
|
||||
end
|
|
@ -1,41 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor total ARP entries
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional)
|
||||
#
|
||||
# Made by Sven Hartge (sven AT svenhartge DOT de)
|
||||
#
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
# Search for arp
|
||||
which arp >/dev/null 2>/dev/null || (echo "no (can't find arp binary)" && exit 1)
|
||||
|
||||
# ...or success
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title ARP entries'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel Entries'
|
||||
echo 'graph_category network'
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_info This graph shows the number of ARP entries registered by the system.'
|
||||
echo 'entries.label ARP entries'
|
||||
echo 'entries.draw LINE2'
|
||||
echo 'entries.type GAUGE'
|
||||
echo 'entries.info Number of ARP entries'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
arp -an | awk 'BEGIN { regex="<incomplete>";} { if (!match($4,regex)) { a[$4] }} END{for(i in a){n++};print "entries.value " n}'
|
|
@ -1,67 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor ARP entries per interface
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional)
|
||||
#
|
||||
# Made by Sven Hartge (sven AT svenhartge DOT de)
|
||||
# change to iproute by Martin89 (martin AT martin89 DOT de)
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
case "$1" in
|
||||
autoconf)
|
||||
# Search for ip
|
||||
which ip >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "no (can't find ip binary)"
|
||||
exit 1
|
||||
fi
|
||||
# ...or success
|
||||
echo 'yes'
|
||||
exit 0
|
||||
;;
|
||||
suggest)
|
||||
if [ ! -r /proc/net/dev ]; then
|
||||
exit 1
|
||||
fi
|
||||
awk '$1~ /^(eth|wlan|ath|ra)[0-9]+(\.[0-9]+)?/ { gsub(":", ""); gsub("\.", "_"); print $1 }' /proc/net/dev
|
||||
exit 0
|
||||
;;
|
||||
config)
|
||||
INTERFACE="$(basename $0 | sed 's/^arp_//g' | tr '_' '.')"
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
echo "graph_title ARP/NDP entries for $INTERFACE"
|
||||
cat <<'EOM'
|
||||
graph_args --base 1000 -l 0
|
||||
graph_vlabel Entries
|
||||
graph_category network
|
||||
graph_scale no
|
||||
graph_info This graph shows the number of ARP and NDP entries for a interface.
|
||||
entries4.label ARP entries
|
||||
entries4.info Number of ARP entries
|
||||
entries6global.label NDP global entries
|
||||
entries6global.info Number of NDP entries for global IPv6 address
|
||||
entries6local.label NDP local entries
|
||||
entries6local.info Number of NDP entries for link-local IPv6 address (fe80::/64)
|
||||
EOM
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
INTERFACE="$(basename $0 | sed 's/^arp_//g' | tr '_' '.')"
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
ip neigh show dev "$INTERFACE" | awk 'BEGIN { a=0; b=0; c=0 }
|
||||
/(REACHABLE|DELAY|STALE)/ { if ($1~ /^fe80:/){c++} else{if ($1~ /^[0-9]+\./) {a++} else{b++} } }
|
||||
END { print "entries4.value", a "\nentries6global.value", b, "\nentries6local.value", c }'
|
|
@ -1,54 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Wildcard-plugin to monitor arp on interfaces. To monitor an
|
||||
# interface, link arp_bsd_<interface> to this file. E.g.
|
||||
#
|
||||
# ln -s /usr/local/share/munin/plugins/arp_bsd_ /usr/local/etc/munin/plugins/arp_bsd_vlanX
|
||||
#
|
||||
# ...will monitor arp on interface vlanX.
|
||||
#
|
||||
# Any device found in /sbin/ifconfig can be monitored.
|
||||
#
|
||||
# Bugs : This plugins has been tested extensively on FreeBSD only
|
||||
#
|
||||
# Author : Luc Duchosal <luc.duchosal (at) arcantel (dot) ch>
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and some installation
|
||||
# scripts):
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
|
||||
INTERFACE=`basename $0 | sed 's/^arp_bsd_//g'`
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -x /sbin/ifconfig ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo "no (/sbin/ifconfig not found)"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "suggest" ]; then
|
||||
if [ -x /sbin/ifconfig ]; then
|
||||
/sbin/ifconfig -a | /usr/bin/grep -E '^[a-z]' | /usr/bin/awk -F\: '{print $1;}'
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo "graph_title $INTERFACE arp"
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel arp per ${graph_period}'
|
||||
echo 'graph_category network'
|
||||
echo 'arp.label arp'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
/usr/sbin/arp -an | /usr/bin/grep $INTERFACE | /usr/bin/wc -l | /usr/bin/awk '{ print "arp.value", $1;}'
|
|
@ -1,135 +0,0 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
##############################
|
||||
#
|
||||
# Plugin: AVM Fritz!Box WAN traffic (over UPNP)
|
||||
#
|
||||
# Author: Andreas Kreisl
|
||||
#
|
||||
# Licence: Creative Commons - Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
# http://creativecommons.org/licenses/by-sa/3.0/
|
||||
#
|
||||
##############################
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
$host = "fritz.box";
|
||||
|
||||
if(isset($argv[1]) && $argv[1] == "autoconf") {
|
||||
echo "yes\n";
|
||||
} else if(isset($argv[1]) && $argv[1] == "config") {
|
||||
$data_prop = GetCommonLinkProperties();
|
||||
//$data_ip = GetExternalIP(); // $data_ip['NewExternalIPAddress']
|
||||
echo "graph_order down up maxdown maxup\n";
|
||||
echo "graph_title AVM Fritz!Box WAN traffic\n";
|
||||
echo "graph_args --base 1024\n";
|
||||
echo "graph_vlabel bits in (-) / out (+) per \${graph_period}\n";
|
||||
echo "graph_category network\n";
|
||||
echo "graph_info This graph shows the traffic of the AVM Fritz!Box WAN network interface. Please note that the traffic is shown in bits per second, not bytes.\n";
|
||||
echo "down.label received\n";
|
||||
echo "down.type DERIVE\n";
|
||||
echo "down.graph no\n";
|
||||
echo "down.cdef down,8,*\n";
|
||||
echo "down.min 0\n";
|
||||
echo "down.max 1000000000\n";
|
||||
echo "up.label " . $data_prop['NewWANAccessType'] . " (" . $data_prop['NewPhysicalLinkStatus'] . ")\n";
|
||||
echo "up.type DERIVE\n";
|
||||
echo "up.negative down\n";
|
||||
echo "up.draw AREA\n";
|
||||
echo "up.cdef up,8,*\n";
|
||||
echo "up.min 0\n";
|
||||
echo "up.max 1000000000\n";
|
||||
echo "up.info Traffic of the WAN interface.\n";
|
||||
echo "maxdown.label received\n";
|
||||
echo "maxdown.type GAUGE\n";
|
||||
echo "maxdown.graph no\n";
|
||||
echo "maxup.label MAX\n";
|
||||
echo "maxup.type GAUGE\n";
|
||||
echo "maxup.negative maxdown\n";
|
||||
echo "maxup.draw LINE1\n";
|
||||
echo "maxup.info Maximum speed of the WAN interface.\n";
|
||||
} else {
|
||||
$data_prop = GetCommonLinkProperties();
|
||||
$data_stats = GetAddonInfos();
|
||||
echo "up.value " . $data_stats['NewTotalBytesSent'] . "\n";
|
||||
echo "down.value " . $data_stats['NewTotalBytesReceived'] . "\n";
|
||||
echo "maxup.value " . $data_prop['NewLayer1UpstreamMaxBitRate'] . "\n";
|
||||
echo "maxdown.value " . $data_prop['NewLayer1DownstreamMaxBitRate'] . "\n";
|
||||
}
|
||||
|
||||
|
||||
function GetCommonLinkProperties() {
|
||||
$data_url = '/igdupnp/control/WANCommonIFC1';
|
||||
$data_soap = '"urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1#GetCommonLinkProperties"';
|
||||
$data_xml = '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetCommonLinkProperties xmlns:u=urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 /></s:Body></s:Envelope>';
|
||||
$tmp = DoCurl($data_url,$data_soap,$data_xml);
|
||||
$data_result = Array();
|
||||
$data_result['NewLayer1UpstreamMaxBitRate'] = FindKey($tmp,"NewLayer1UpstreamMaxBitRate");
|
||||
$data_result['NewLayer1DownstreamMaxBitRate'] = FindKey($tmp,"NewLayer1DownstreamMaxBitRate");
|
||||
$data_result['NewWANAccessType'] = FindKey($tmp,"NewWANAccessType");
|
||||
$data_result['NewPhysicalLinkStatus'] = FindKey($tmp,"NewPhysicalLinkStatus");
|
||||
return $data_result;
|
||||
}
|
||||
|
||||
function GetAddonInfos() {
|
||||
$data_url = '/igdupnp/control/WANCommonIFC1';
|
||||
$data_soap = '"urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1#GetAddonInfos"';
|
||||
$data_xml = '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetAddonInfos xmlns:u=urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 /></s:Body></s:Envelope>';
|
||||
$tmp = DoCurl($data_url,$data_soap,$data_xml);
|
||||
$data_result = Array();
|
||||
$data_result['NewTotalBytesSent'] = FindKey($tmp,"NewTotalBytesSent");
|
||||
$data_result['NewTotalBytesReceived'] = FindKey($tmp,"NewTotalBytesReceived");
|
||||
return $data_result;
|
||||
}
|
||||
|
||||
function GetExternalIP() {
|
||||
$data_url = '/igdupnp/control/WANIPConn1';
|
||||
$data_soap = '"urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress"';
|
||||
$data_xml = '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetExternalIPAddress xmlns:u=urn:schemas-upnp-org:service:WANIPConnection:1 /></s:Body></s:Envelope>';
|
||||
$tmp = DoCurl($data_url,$data_soap,$data_xml);
|
||||
$data_result = Array();
|
||||
$data_result['NewExternalIPAddress'] = FindKey($tmp,"NewExternalIPAddress");
|
||||
return $data_result;
|
||||
}
|
||||
|
||||
function DoCurl($url,$soap,$xml) {
|
||||
$ch = curl_init("http://" . $GLOBALS["host"] . ":49000" . $url);
|
||||
|
||||
$headers = array();
|
||||
//$headers[] = 'POST ' . $url . ' HTTP/1.1'; // Will be automatically set.
|
||||
$headers[] = 'Content-Type: text/xml; charset="utf-8"';
|
||||
$headers[] = 'HOST: ' . $GLOBALS["host"] . ':49000';
|
||||
$headers[] = 'Content-Length: ' . strlen($xml);
|
||||
$headers[] = 'SOAPACTION: ' . $soap;
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_IPRESOLVE, 1); // Force IPv4
|
||||
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); // Add XML in POST-Header
|
||||
|
||||
$tmp = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
function FindKey($text,$key) {
|
||||
$p1 = strpos($text,$key);
|
||||
if($p1 === false) {
|
||||
$tmp = "";
|
||||
} else {
|
||||
$p1 = strpos($text,'>',$p1) +1;
|
||||
$p2 = strpos($text,'<',$p1);
|
||||
if($p2 === false) {
|
||||
$tmp = "";
|
||||
} else {
|
||||
$tmp = substr($text,$p1,$p2-$p1);
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,48 +0,0 @@
|
|||
#!/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"
|
|
@ -1,57 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
cat <<'EOM'
|
||||
graph_order snrdown snrup pwrdown pwrup
|
||||
graph_title dsl stats
|
||||
graph_args --base 1000
|
||||
graph_category Network
|
||||
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)
|
||||
|
||||
|
||||
# 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 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
|
Loading…
Add table
Add a link
Reference in a new issue