Projet

Général

Profil

Révision 1ae4ac09

ID1ae4ac09dae4e2b8fcbec46bca0b867be82875df
Parent a1cc26f2
Enfant 49aecf4e

Ajouté par Jose Manuel Febrer Cortés il y a plus de 7 ans

Update multibandwidth

I will update more changes in the next days

Voir les différences:

plugins/network/multibandwidth
1
#!/bin/sh                                                                                                                                                                                                         
2
                                                                                                                                                                                                                  
3
. "$MUNIN_LIBDIR/plugins/plugin.sh"                                                                                                                                                                               
4
                                                                                                                                                                                                                  
5
: <<=cut                                                                                                                                                                                                          
6
                                                                                                                                                                                                                  
7
=head1 NAME                                                                                                                                                                                                       
8
                                                                                                                                                                                                                  
9
multibandwidth - Plugin to monitor the bandwidth between localhost and serveral hosts.                                                                                                                            
10
                                                                                                                                                                                                                  
11
=head1 APPLICABLE SYSTEMS                                                                                                                                                                                         
12
                                                                                                                                                                                                                  
13
All systems with “bash”, and “munin”                                                                                                                                                                              
14
                                                                                                                                                                                                                  
15
=head1 REQUIREMENTS                                                                                                                                                                                               
16
                                                                                                                                                                                                                  
17
bing installed.                                                                                                                                                                                                   
18
                                                                                                                                                                                                                  
19
You can install bing by using (Ubuntu/Debian): apt-get install bing                                                                                                                                               
20
                                                                                                                                                                                                                  
21
=head1 CONFIGURATION                                                                                                                                                                                              
22
                                                                                                                                                                                                                  
23
The following is the default configuration                                                                                                                                                                        
24
                                                                                                                                                                                                                  
25
[multibandwidth]                                                                                                                                                                                                  
26
user root                                                                                                                                                                                                         
27
env.hosts example.org example2.org example3.org                                                                                                                                                                   
28
env.samples 15                                                                                                                                                                                                    
29
env.small_packet_size 44                                                                                                                                                                                          
30
env.big_packet_size 108                                                                                                                                                                                           
31
env.max_mbps 15728640                                                                                                                                                                                             
32
                                                                                                                                                                                                                  
33
- env.hosts explanation: hostname or IP of the hosts to calculate the bandwidth.                                                                                                                                  
34
                                                                                                                                                                                                                  
35
- env.samples explanation: Reset stats after sending samples ECHO_REQUEST packets.                                                                                                                                
1
#!/bin/sh
2

  
3
. "$MUNIN_LIBDIR/plugins/plugin.sh"
4

  
5
: <<=cut
6

  
7
=head1 NAME
8

  
9
multibandwidth - Plugin to monitor the bandwidth between localhost and serveral hosts.
10

  
11
=head1 APPLICABLE SYSTEMS
12

  
13
All systems with “bash”, and “munin”
14

  
15
=head1 REQUIREMENTS
16

  
17
bing installed.
18

  
19
You can install bing by using (Ubuntu/Debian): apt-get install bing
20

  
21
=head1 CONFIGURATION
22

  
23
The following is the default configuration
24

  
25
[multibandwidth]
26
user root
27
env.hosts example.org example2.org example3.org
28
env.samples 15
29
env.small_packet_size 44
30
env.big_packet_size 108
31
env.max_mbps 15728640
32

  
33
- env.hosts explanation: hostname or IP of the hosts to calculate the bandwidth.
34

  
35
- env.samples explanation: Reset stats after sending samples ECHO_REQUEST packets.
36 36

  
37 37
- env.small_packet_size explanation: Specifies the number of data bytes to be sent in the small
38 38
        packets. The default and minimum value is 44.
......
107 107
                VALUE=`echo "$SPEED" | sed 's/.$//'`
108 108
                RATE=`echo "$VALUE * 1048576" | bc -l`
109 109

  
110
                if [ $(echo "$RATE" >= "$max_mbps" | bc >/dev/null && echo "no" || echo "yes") = "yes" ]; then
110
                if [ `echo "$RATE > $max_mbps" | bc` -eq "1" ]; then
111 111
                        echo "$max_mbps"
112 112
                else
113 113
                        echo "$RATE"

Formats disponibles : Unified diff