Révision 569e801e
apache_status: make it easy to monitor other hosts as a virtual node
| plugins/apache/apache_status | ||
|---|---|---|
| 104 | 104 |
use warnings; |
| 105 | 105 |
use Munin::Plugin; |
| 106 | 106 |
|
| 107 |
$0 =~ /apache_status(?:_(.+))$/; |
|
| 108 |
my $HOSTNAME = $1; |
|
| 109 |
|
|
| 107 | 110 |
my $ret = undef; |
| 108 | 111 |
|
| 109 | 112 |
if (! eval "require LWP::UserAgent;") {
|
| ... | ... | |
| 113 | 116 |
} |
| 114 | 117 |
} |
| 115 | 118 |
|
| 116 |
my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://127.0.0.1:%d/server-status?auto";
|
|
| 119 |
if ( exists $ENV{'hostname'} ) {
|
|
| 120 |
$HOSTNAME = $ENV{'hostname'};
|
|
| 121 |
} |
|
| 122 |
|
|
| 123 |
my $URL = "http://127.0.0.1:%d/server-status?auto"; |
|
| 124 |
if ( exists $ENV{'url'} ) {
|
|
| 125 |
$URL = $ENV{'url'};
|
|
| 126 |
} elsif ( defined $HOSTNAME ) {
|
|
| 127 |
$URL = "http://$HOSTNAME:%d/server-status?auto" |
|
| 128 |
} |
|
| 129 |
|
|
| 117 | 130 |
my @PORTS = exists $ENV{'ports'} ? split(' ', $ENV{'ports'}) : (80);
|
| 118 | 131 |
my $UA = LWP::UserAgent->new(timeout => 30, |
| 119 | 132 |
agent => sprintf("munin/%s (libwww-perl/%s)", $Munin::Common::Defaults::MUNIN_VERSION, $LWP::VERSION));
|
| ... | ... | |
| 148 | 161 |
} |
| 149 | 162 |
|
| 150 | 163 |
if ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
|
| 164 |
if ( defined $HOSTNAME ) {
|
|
| 165 |
print "host_name $HOSTNAME\n"; |
|
| 166 |
} |
|
| 167 |
|
|
| 151 | 168 |
print <<END; |
| 152 | 169 |
|
| 153 | 170 |
multigraph apache_accesses |
Formats disponibles : Unified diff