mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Update multibandwidth
bing have some random spikes. Added a variable that is used to indicate the maximum value of mbps that can be recorded (in bps).
This commit is contained in:
parent
651f6ac056
commit
a1cc26f2d3
1 changed files with 49 additions and 37 deletions
|
@ -1,37 +1,38 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. "$MUNIN_LIBDIR/plugins/plugin.sh"
|
. "$MUNIN_LIBDIR/plugins/plugin.sh"
|
||||||
|
|
||||||
: <<=cut
|
: <<=cut
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
multibandwidth - Plugin to monitor the bandwidth between localhost and serveral hosts.
|
multibandwidth - Plugin to monitor the bandwidth between localhost and serveral hosts.
|
||||||
|
|
||||||
=head1 APPLICABLE SYSTEMS
|
=head1 APPLICABLE SYSTEMS
|
||||||
|
|
||||||
All systems with “bash”, and “munin”
|
All systems with “bash”, and “munin”
|
||||||
|
|
||||||
=head1 REQUIREMENTS
|
=head1 REQUIREMENTS
|
||||||
|
|
||||||
bing installed.
|
bing installed.
|
||||||
|
|
||||||
You can install bing by using (Ubuntu/Debian): apt-get install bing
|
You can install bing by using (Ubuntu/Debian): apt-get install bing
|
||||||
|
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
|
||||||
The following is the default configuration
|
The following is the default configuration
|
||||||
|
|
||||||
[multibandwidth]
|
[multibandwidth]
|
||||||
user root
|
user root
|
||||||
env.hosts example.org example2.org example3.org
|
env.hosts example.org example2.org example3.org
|
||||||
env.samples 10
|
env.samples 15
|
||||||
env.small_packet_size 44
|
env.small_packet_size 44
|
||||||
env.big_packet_size 108
|
env.big_packet_size 108
|
||||||
|
env.max_mbps 15728640
|
||||||
- env.hosts explanation: hostname or IP of the hosts to calculate the bandwidth.
|
|
||||||
|
- 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.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
|
- 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.
|
packets. The default and minimum value is 44.
|
||||||
|
@ -40,6 +41,8 @@ env.big_packet_size 108
|
||||||
packets. The default is 108. The size should be chosen so that big packet roundtrip times
|
packets. The default is 108. The size should be chosen so that big packet roundtrip times
|
||||||
are long enough to be accurately measured.
|
are long enough to be accurately measured.
|
||||||
|
|
||||||
|
- env.max_mbps explanation: bing have some random spikes. This variable is used to indicate
|
||||||
|
the maximum value of mbps that can be recorded (in bps).
|
||||||
|
|
||||||
=head1 MAGIC MARKERS
|
=head1 MAGIC MARKERS
|
||||||
|
|
||||||
|
@ -101,11 +104,20 @@ for host in $hosts; do
|
||||||
| cut -d "b" -f1)
|
| cut -d "b" -f1)
|
||||||
|
|
||||||
if (echo "$SPEED" | grep -q "M"); then
|
if (echo "$SPEED" | grep -q "M"); then
|
||||||
echo "$SPEED" | awk '{a+=$1} END{print a*1000000}'
|
VALUE=`echo "$SPEED" | sed 's/.$//'`
|
||||||
|
RATE=`echo "$VALUE * 1048576" | bc -l`
|
||||||
|
|
||||||
|
if [ $(echo "$RATE" >= "$max_mbps" | bc >/dev/null && echo "no" || echo "yes") = "yes" ]; then
|
||||||
|
echo "$max_mbps"
|
||||||
|
else
|
||||||
|
echo "$RATE"
|
||||||
|
fi
|
||||||
elif (echo "$SPEED" | grep -q "K"); then
|
elif (echo "$SPEED" | grep -q "K"); then
|
||||||
echo "$SPEED" | awk '{a+=$1} END{print a*1000}'
|
VALUE=`echo "$SPEED" | sed 's/.$//'`
|
||||||
|
echo "$VALUE * 1024" | bc -l
|
||||||
elif (echo "$SPEED" | grep -q "G"); then
|
elif (echo "$SPEED" | grep -q "G"); then
|
||||||
echo "$SPEED" | awk '{a+=$1} END{print a*1000000000}'
|
VALUE=`echo "$SPEED" | sed 's/.$//'`
|
||||||
|
echo "$VALUE * 1073742000" | bc -l
|
||||||
else
|
else
|
||||||
echo "Error: no data (timeout)" >&2
|
echo "Error: no data (timeout)" >&2
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue