Révision 623735f6
Initial version
| plugins/other/php_xcache | ||
|---|---|---|
| 1 |
#!/usr/bin/perl -w |
|
| 2 |
# |
|
| 3 |
|
|
| 4 |
require LWP::UserAgent; |
|
| 5 |
|
|
| 6 |
######################################################################################## |
|
| 7 |
# |
|
| 8 |
# Installation / Configuration |
|
| 9 |
# |
|
| 10 |
# - place munin_xcache.php in a directory on your webserver |
|
| 11 |
# - add the url config to plugin-conf.d/munin-node |
|
| 12 |
# |
|
| 13 |
# |
|
| 14 |
# for more info see http://www.ohardt.net/dev/munin/ |
|
| 15 |
# |
|
| 16 |
# |
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
chomp(my $fqdn=`hostname -f`); |
|
| 21 |
|
|
| 22 |
|
|
| 23 |
my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://user:pwd\@$fqdn/munin_xcache_new.php";
|
|
| 24 |
|
|
| 25 |
$URL = $URL . "?what=mem"; |
|
| 26 |
|
|
| 27 |
my $ua = LWP::UserAgent->new(timeout => 30); |
|
| 28 |
|
|
| 29 |
|
|
| 30 |
if ( exists $ARGV[0] and $ARGV[0] eq "config" ) |
|
| 31 |
{
|
|
| 32 |
|
|
| 33 |
$URL = $URL . '&config'; |
|
| 34 |
|
|
| 35 |
my $response = $ua->request(HTTP::Request->new('GET',$URL . '&config' ));
|
|
| 36 |
|
|
| 37 |
print $response->content; |
|
| 38 |
|
|
| 39 |
|
|
| 40 |
exit( 0 ); |
|
| 41 |
} |
|
| 42 |
|
|
| 43 |
|
|
| 44 |
my $response = $ua->request(HTTP::Request->new('GET',$URL));
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
print $response->content; |
|
| 48 |
|
|
| 49 |
|
|
| 50 |
exit( 0 ); |
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
Formats disponibles : Unified diff