root / plugins / memcached / memcached_items_ @ 8589c6df
Historique | Voir | Annoter | Télécharger (823 octets)
| 1 |
#!/usr/bin/env perl |
|---|---|
| 2 |
# ex:ts=4 |
| 3 |
|
| 4 |
use strict; |
| 5 |
use warnings; |
| 6 |
|
| 7 |
use Cache::Memcached; |
| 8 |
|
| 9 |
my $cmd = shift || ''; |
| 10 |
if ($cmd eq 'config') {
|
| 11 |
print "graph_title Memcached cached items\n"; |
| 12 |
print "graph_args --base 1000 -l 0\n"; |
| 13 |
print "graph_vlabel items\n"; |
| 14 |
print "graph_category memory\n"; |
| 15 |
print "graph_info This graph monitors the number of items stored by the memcached server.\n"; |
| 16 |
print "items.label items\n"; |
| 17 |
print "items.info Number of cached items\n"; |
| 18 |
print "items.min 0\n"; |
| 19 |
print "items.draw AREA\n"; |
| 20 |
exit 0; |
| 21 |
} |
| 22 |
|
| 23 |
$0 =~ /memcached_items_(\d+_\d+_\d+_\d+)_(\d+)$/; |
| 24 |
my ($ip, $port) = ($1, $2); |
| 25 |
$ip =~ s/_/./g; |
| 26 |
my $address = "$ip:$port"; |
| 27 |
|
| 28 |
my $memd = new Cache::Memcached { 'servers' => [$address] };
|
| 29 |
my $memstats = $memd->stats(['misc']); |
| 30 |
|
| 31 |
print "items.value " . |
| 32 |
$memstats->{hosts}->{$address}->{misc}->{curr_items} . "\n";
|
