Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/nginx/nginx_byprojects/byprojects_bandwidth | ||
|---|---|---|
| 7 | 7 |
# Perl script to monitor total bandwidth *byprojects* (e.g. vhost) from multiple |
| 8 | 8 |
# files and/or regex. |
| 9 | 9 |
# |
| 10 |
# Danny Fullerton <northox@mantor.org>
|
|
| 10 |
# Danny Fullerton <northox@mantor.org> |
|
| 11 | 11 |
# Mantor Organization <www.mantor.org> |
| 12 | 12 |
# This work is licensed under a MIT license. |
| 13 | 13 |
# |
| 14 | 14 |
# You need logtail (https://www.fourmilab.ch/webtools/logtail/) |
| 15 | 15 |
# |
| 16 |
# Your nginx configuration should look like this (i.e. $request_length
|
|
| 16 |
# Your nginx configuration should look like this (i.e. $request_length |
|
| 17 | 17 |
# body_bytes_sent at the end): |
| 18 | 18 |
# log_format main '$remote_addr - $remote_user $time_local "$request" ' |
| 19 | 19 |
# '$status $body_bytes_sent "$http_referer" ' |
| 20 | 20 |
# '"$http_user_agent" $request_length $body_bytes_sent'; |
| 21 | 21 |
# |
| 22 |
# Log can be gathered from multiple sources by simply specifying multiple log
|
|
| 22 |
# Log can be gathered from multiple sources by simply specifying multiple log |
|
| 23 | 23 |
# filename or using wildcards (glob). File content can be selected using regex. |
| 24 | 24 |
# |
| 25 | 25 |
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
|
| ... | ... | |
| 80 | 80 |
my @paths = glob $log->{'path'};
|
| 81 | 81 |
foreach my $path (@paths) {
|
| 82 | 82 |
my $state = $statepath.'/'.$project.$x.'_totalbandwidth.state'; |
| 83 |
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
|
|
| 83 |
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
|
|
| 84 | 84 |
die "Can't open $logtail : $!"; |
| 85 | 85 |
while (<LT>) {
|
| 86 | 86 |
my $buf = $_; |
Formats disponibles : Unified diff