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.
58 lines
998 B
Bash
Executable File
58 lines
998 B
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 current Power
|
|
|
|
=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 Aggregate Tx Power"
|
|
echo 'graph_args --base 1000'
|
|
echo 'graph_vlabel Actual Aggregate Tx Power (dBm)'
|
|
echo 'graph_category hg612'
|
|
echo 'graph_scale no'
|
|
echo 'downstream.label Downstream'
|
|
echo 'downstream.draw LINE'
|
|
echo 'upstream.label Upstream'
|
|
echo 'upstream.draw LINE'
|
|
exit 0
|
|
fi;
|
|
|
|
|
|
echo -n "downstream.value "
|
|
echo $(grep Pwr $statsfile | head -n 1 | awk '{ print $2 }')
|
|
echo -n "upstream.value "
|
|
echo $(grep Pwr $statsfile | head -n 1 | awk '{ print $3 }')
|
|
|
|
exit 0
|
|
fi
|