Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/network/bandwidth_ | ||
|---|---|---|
| 18 | 18 |
|
| 19 | 19 |
Most likely usage is to monitor an interface connected to your ISP. |
| 20 | 20 |
|
| 21 |
The suggest option will try and determine if you have any interfaces with a
|
|
| 21 |
The suggest option will try and determine if you have any interfaces with a |
|
| 22 | 22 |
public IP and if so it will suggest monitoring those interfaces. If all |
| 23 | 23 |
IP addresses are private the setup will have to be done manually. Suggest |
| 24 | 24 |
does not handle IPv6 addresses. |
| ... | ... | |
| 192 | 192 |
} |
| 193 | 193 |
|
| 194 | 194 |
sub read_traffic {
|
| 195 |
open( my $rx, "<", "/sys/class/net/$interface/statistics/rx_bytes" )
|
|
| 195 |
open( my $rx, "<", "/sys/class/net/$interface/statistics/rx_bytes" ) |
|
| 196 | 196 |
|| die "Unable to read: $!"; |
| 197 | 197 |
$counter_input = <$rx>; |
| 198 | 198 |
chomp $counter_input; |
| 199 | 199 |
close($rx); |
| 200 |
open(my $tx , "<", "/sys/class/net/$interface/statistics/tx_bytes" )
|
|
| 200 |
open(my $tx , "<", "/sys/class/net/$interface/statistics/tx_bytes" ) |
|
| 201 | 201 |
|| die "Unable to read: $!"; |
| 202 | 202 |
$counter_output = <$tx>; |
| 203 | 203 |
chomp $counter_output; |
| ... | ... | |
| 231 | 231 |
else {
|
| 232 | 232 |
if ( $perf_ref->{last}->{counter_input} > $counter_input ) {
|
| 233 | 233 |
$input = |
| 234 |
$counter_input
|
|
| 234 |
$counter_input |
|
| 235 | 235 |
+ $rollover |
| 236 | 236 |
- $perf_ref->{last}->{counter_input};
|
| 237 | 237 |
} |
| ... | ... | |
| 240 | 240 |
} |
| 241 | 241 |
if ( $perf_ref->{last}->{counter_output} > $counter_output ) {
|
| 242 | 242 |
$output = |
| 243 |
$counter_output
|
|
| 243 |
$counter_output |
|
| 244 | 244 |
+ $rollover |
| 245 | 245 |
- $perf_ref->{last}->{counter_output};
|
| 246 | 246 |
} |
Formats disponibles : Unified diff