mirror of
https://github.com/nikdoof/huawei-hg612-munin.git
synced 2025-12-23 15:49:23 +00:00
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.
65 lines
1.1 KiB
Bash
Executable File
65 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 WAN interface traffic
|
|
|
|
=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 ptm1 traffic"
|
|
echo "graph_args --base 1000"
|
|
echo 'graph_vlabel bytes per ${graph_period}'
|
|
echo "graph_category hg612"
|
|
echo "down.label received"
|
|
echo "down.type DERIVE"
|
|
# echo "down.graph no"
|
|
echo "down.min 0"
|
|
# echo "down.max 1000000"
|
|
echo "down.cdef down,8,*"
|
|
echo "down.draw AREA"
|
|
echo "up.label sent"
|
|
echo "up.type DERIVE"
|
|
# echo "up.negative down"
|
|
echo "up.info Traffic of the ptm1 interface."
|
|
echo "up.min 0"
|
|
# echo "up.max 1000000"
|
|
echo "up.cdef up,8,*"
|
|
|
|
exit 0
|
|
fi;
|
|
|
|
echo -n "down.value " ; grep "RX bytes" $statsfile | sed -e 's/:/\ /g' | awk '{ print $3 }'
|
|
echo -n "up.value " ; grep "TX bytes" $statsfile | sed -e 's/:/\ /g' | awk '{ print $8 }'
|
|
|
|
exit 0
|
|
fi
|