Files
huawei-hg612-munin/plugins/hg612_current_speed
root c92256cc47 Allow configuring statsfile using env.statsfile.
Set the default to /var/lib/munin/plugin-state/huawei-hg612-munin-output.txt
for safety.

Include a crontab file to be placed in /etc/cron.d.

Update readme to match, and simplify.
2013-03-21 14:04:49 +00:00

59 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# -*- sh -*-
statsfile=${statsfile:-/var/lib/munin/plugin-state/huawei-hg612-munin-output.txt}
: << =cut
=head1 NAME
Line Stats - Plugin to get Huawei HG612 line stats
=head1 NOTES
Fetches attainable line speed vs actual line speed
=head1 AUTHOR
Adam Smith
=head1 LICENSE
GPL
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Sync Speed"
echo 'graph_args --base 1000'
echo 'graph_vlabel Speed (bps)'
echo 'graph_category hg612'
echo 'graph_scale yes'
echo 'graph_order downstream upstream'
echo 'downstream.label Downstream'
echo 'downstream.draw AREA'
echo 'upstream.label Upstream'
echo 'upstream.draw AREA'
exit 0
fi;
echo -n "downstream.value "
echo $(grep Upstream $statsfile | grep Path | head -n 1 | awk '{ print $11 }')000
echo -n "upstream.value "
echo $(grep Upstream $statsfile | grep Path | head -n 1 | awk '{ print $6 }')000
exit 0
fi