Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/s3/s3_storage | ||
|---|---|---|
| 3 | 3 |
use strict; |
| 4 | 4 |
use warnings; |
| 5 | 5 |
|
| 6 |
my $s3_id = exists $ENV{'s3_id'} ? $ENV{'s3_id'} : "user";
|
|
| 6 |
my $s3_id = exists $ENV{'s3_id'} ? $ENV{'s3_id'} : "user";
|
|
| 7 | 7 |
my $s3curl = "perl s3-curl/s3curl.pl --id $s3_id -- -s -S"; |
| 8 | 8 |
|
| 9 | 9 |
sub get_bucket_list() |
| ... | ... | |
| 11 | 11 |
my $buckets = `$s3curl http://s3.amazonaws.com`; |
| 12 | 12 |
my $str = $buckets; |
| 13 | 13 |
my @bucket_list; |
| 14 |
|
|
| 14 |
|
|
| 15 | 15 |
while ($buckets =~ s/.<Name>([\w._-]+)<\/Name>//) |
| 16 | 16 |
{
|
| 17 | 17 |
push @bucket_list, $1; |
| 18 |
}
|
|
| 18 |
} |
|
| 19 | 19 |
|
| 20 |
return @bucket_list;
|
|
| 20 |
return @bucket_list; |
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 | 23 |
my @bucket_list = split /\s+/, ($ENV{'buckets'} || '');
|
| ... | ... | |
| 45 | 45 |
my ($name) = @_; |
| 46 | 46 |
my $stats = `$s3curl http://$name.s3.amazonaws.com`; |
| 47 | 47 |
my %res; |
| 48 |
|
|
| 48 |
|
|
| 49 | 49 |
$res{'size'} = 0;
|
| 50 |
|
|
| 50 |
|
|
| 51 | 51 |
while ($stats =~ s/.<Size>([\w._-]+)<\/Size>//) |
| 52 | 52 |
{
|
| 53 | 53 |
$res{'size'} += $1;
|
| ... | ... | |
| 65 | 65 |
print "graph_args --base 1024 -l 0\n"; |
| 66 | 66 |
print "graph_vlabel bytes\n"; |
| 67 | 67 |
print "graph_info Plugin available at <a href='https://github.com/aptivate/munin-contrib/blob/master/plugins/s3/s3_storage'>https://github.com/aptivate/munin-contrib/blob/master/plugins/s3/s3_storage</a>\n"; |
| 68 |
|
|
| 68 |
|
|
| 69 | 69 |
foreach my $bucket_name (@bucket_list) |
| 70 | 70 |
{
|
| 71 | 71 |
print "$bucket_name.label Bucket $bucket_name\n"; |
| 72 |
}
|
|
| 72 |
} |
|
| 73 | 73 |
|
| 74 | 74 |
exit; |
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
foreach my $bucket_name (@bucket_list) |
| 78 | 78 |
{
|
| 79 |
my %stats = get_bucket_stats($bucket_name);
|
|
| 79 |
my %stats = get_bucket_stats($bucket_name); |
|
| 80 | 80 |
print "$bucket_name.value " . $stats{'size'} . "\n";
|
| 81 | 81 |
} |
| 82 | 82 |
|
Formats disponibles : Unified diff