mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
multibandwidth
Plugin to monitor the bandwidth between localhost and serveral hosts.
This commit is contained in:
parent
e3169d5930
commit
26e9009dc5
1 changed files with 97 additions and 0 deletions
97
plugins/network/multibandwidth
Normal file
97
plugins/network/multibandwidth
Normal file
|
@ -0,0 +1,97 @@
|
|||
#!/bin/sh
|
||||
|
||||
: <<=cut
|
||||
|
||||
=head1 NAME
|
||||
|
||||
multibandwidth - Plugin to monitor the bandwidth between localhost and serveral hosts.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
All systems with "bash", and "munin"
|
||||
|
||||
=head1 REQUIREMENTS
|
||||
|
||||
bing installed.
|
||||
|
||||
You can install bing by using (Ubuntu/Debian): apt-get install bing
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
The following is the default configuration
|
||||
|
||||
[multibandwidth]
|
||||
user root
|
||||
env.hosts example.org example2.org example3.org
|
||||
env.samples 10
|
||||
env.small_packet_size 1000
|
||||
env.big_packet_size 8000
|
||||
|
||||
- env.hosts explanation: hostname or IP of the hosts to calculate the bandwidth.
|
||||
|
||||
- env.samples explanation: Reset stats after sending samples ECHO_REQUEST packets.
|
||||
|
||||
- env.small_packet_size explanation: Specifies the number of data bytes to be sent in the small packets. The default and minimum value is 44.
|
||||
|
||||
- env.big_packet_size explanation: Specifies the number of data bytes to be sent in the big packets. The default is 108. The size should be chosen so that big packet roundtrip times are long enough to be accurately measured.
|
||||
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.1.17
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Jose Manuel Febrer Cortés <https://www.linkedin.com/in/jfebrer/>
|
||||
Marco Bertola's help <https://www.linkedin.com/in/bertolamarco/>
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
echo graph_title MultiBandwidth
|
||||
echo 'graph_vlabel Mbps'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_category network'
|
||||
echo 'graph_info This graph shows the bandwidth between localhost and serveral hosts'
|
||||
for host in $hosts; do
|
||||
bandwidth=$((bandwidth+1))
|
||||
echo 'bandwidth'"$bandwidth"'.label ' "$host"
|
||||
echo 'bandwidth'"$bandwidth"'.draw LINE2'
|
||||
echo 'bandwidth'"$bandwidth"'.info Bandwidth statistics for '"$host"
|
||||
done
|
||||
exit 0;;
|
||||
autoconf)
|
||||
if hash bing 2>/dev/null; then
|
||||
echo 'yes'
|
||||
exit 0;
|
||||
else
|
||||
echo 'no (bing not installed)'
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
esac
|
||||
|
||||
|
||||
#Calculating the bandwidth
|
||||
for host in $hosts; do
|
||||
bandwidth=$((bandwidth+1))
|
||||
printf "%s""bandwidth""$bandwidth"".value ";
|
||||
#bing output example: host: 4.592Mbps 0.223ms 0.217773us/bit
|
||||
bing localhost "$host" -n -c 1 -e "$samples" -s "$small_packet_size" -S "$big_packet_size" 2>/dev/null \
|
||||
| grep -E "bit$" \
|
||||
| cut -d " " -f3 \
|
||||
| cut -c -5 \
|
||||
| awk '{a+=$1} END{print a/NR}'
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue