Projet

Général

Profil

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

root / plugins / memcached / memcached_hits_ @ ef960abc

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

1
#!/usr/bin/env perl
2
# ex:ts=4
3

    
4
use strict;
5
use warnings;
6

    
7
use Cache::Memcached;
8

    
9
$0 =~ /memcached_hits_(\d+_\d+_\d+_\d+)_(\d+)$/;
10
my ($ip, $port) = ($1, $2);
11
$ip =~ s/_/./g;
12
my $address = "$ip:$port";
13

    
14
my $title = $ENV{title} || $address;
15

    
16
my $cmd = shift || '';
17
if ($cmd eq 'config') {
18
	print "graph_title Memcached cache hits and misses -- $title\n";
19
	print "graph_args --base 1000 -l 0\n";
20
	print "graph_vlabel requests\n";
21
	print "graph_category memcached\n";
22
	print "graph_info This graph monitors the number of cache hits and misses.\n";
23
	print "hits.label hits\n";
24
	print "hits.info Number of cache hits\n";
25
	print "hits.min 0\n";
26
	print "hits.type DERIVE\n";
27
	print "misses.label misses\n";
28
	print "misses.info Number of cache misses\n";
29
	print "misses.min 0\n";
30
	print "misses.type DERIVE\n";
31
	print "misses.draw AREA\n";
32
	exit 0;
33
}
34

    
35
my $memd = new Cache::Memcached { 'servers' => [$address] };
36
my $memstats = $memd->stats(['misc']);
37

    
38
print "hits.value " . $memstats->{hosts}->{$address}->{misc}->{get_hits} . "\n";
39
print "misses.value " .
40
	$memstats->{hosts}->{$address}->{misc}->{get_misses} . "\n";