Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/http/http-response-times | ||
|---|---|---|
| 1 | 1 |
#!/usr/bin/perl |
| 2 | 2 |
use strict; |
| 3 | 3 |
|
| 4 |
# HTTP response times for either entire page views
|
|
| 4 |
# HTTP response times for either entire page views |
|
| 5 | 5 |
# or just the index, depending on configuration. |
| 6 |
# Full or index resource pulling is determined by the suffix of the
|
|
| 6 |
# Full or index resource pulling is determined by the suffix of the |
|
| 7 | 7 |
# script name. ie. http_response_full or http_response_index |
| 8 | 8 |
# |
| 9 | 9 |
|
| 10 | 10 |
# Parameters: |
| 11 |
#
|
|
| 11 |
# |
|
| 12 | 12 |
# config |
| 13 | 13 |
# |
| 14 | 14 |
# Configuration variables: |
| ... | ... | |
| 52 | 52 |
|
| 53 | 53 |
#output configuration and exit - required by Munin |
| 54 | 54 |
if (exists $ARGV[0] and $ARGV[0] eq "config") {
|
| 55 |
print "graph_title $domain Site Response Times - $ENV{'action'}\n";
|
|
| 55 |
print "graph_title $domain Site Response Times - $ENV{'action'}\n";
|
|
| 56 | 56 |
print "graph_category webserver\n"; |
| 57 | 57 |
print "graph_vlabel request time (seconds)\n"; |
| 58 | 58 |
print "graph_info Response times for public areas of $domain.\n"; |
| 59 | 59 |
|
| 60 | 60 |
foreach my $url (@urls) {
|
| 61 |
my $label = $url;
|
|
| 61 |
my $label = $url; |
|
| 62 | 62 |
#fix up our label name to be a valid variable name |
| 63 | 63 |
$label =~ s@[^A-Za-z0-9_]@_@g; |
| 64 | 64 |
print "$label.label $url\n"; |
| ... | ... | |
| 73 | 73 |
|
| 74 | 74 |
#function to make the request and get the response time |
| 75 | 75 |
sub req_time {
|
| 76 |
my $url = shift;
|
|
| 76 |
my $url = shift; |
|
| 77 | 77 |
my $time; |
| 78 | 78 |
my $outdir = '/tmp/munin/' . int(rand(32000)); |
| 79 | 79 |
system("mkdir -p $outdir");
|
| ... | ... | |
| 88 | 88 |
|
| 89 | 89 |
#loop over every url and output the responses |
| 90 | 90 |
foreach my $url (@urls) {
|
| 91 |
my $label = $url;
|
|
| 91 |
my $label = $url; |
|
| 92 | 92 |
#fix up our label name to be a valid name |
| 93 | 93 |
$label =~ s@[^A-Za-z0-9_]@_@g; |
| 94 | 94 |
print "$label.value " . req_time($domain.$url); |
Formats disponibles : Unified diff