Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / memcached / memcached_bytes_ @ d112f623

Historique | Voir | Annoter | Télécharger (1 ko)

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 bytes used\n";
12
	print "graph_args --base 1024 -l 0\n";
13
	print "graph_vlabel bytes\n";
14
	print "graph_category memcached\n";
15
	print "graph_info This graph monitors the size of the memcached cache.\n";
16
	print "bytes.label bytes used\n";
17
	print "bytes.info Number of bytes currently used\n";
18
	print "bytes.min 0\n";
19
	print "bytes.draw AREA\n";
20
	print "maxbytes.label maximum available\n";
21
	print "maxbytes.info The configured cache size\n";
22
	print "maxbytes.min 0\n";
23
	exit 0;
24
}
25

    
26
$0 =~ /memcached_bytes_(\d+_\d+_\d+_\d+)_(\d+)$/;
27
my ($ip, $port) = ($1, $2);
28
$ip =~ s/_/./g;
29
my $address = "$ip:$port";
30

    
31
my $memd = new Cache::Memcached { 'servers' => [$address] };
32
my $memstats = $memd->stats(['misc']);
33

    
34
print "bytes.value " . $memstats->{hosts}->{$address}->{misc}->{bytes} . "\n";
35
print "maxbytes.value " .
36
	$memstats->{hosts}->{$address}->{misc}->{limit_maxbytes} . "\n";