root / plugins / memcached / memcached_connections_ @ 72e4561a
Historique | Voir | Annoter | Télécharger (880 octets)
| 1 | 5dd90f05 | Maxime Henrion | #!/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 connections\n"; |
||
| 12 | print "graph_args --base 1000 -l 0\n"; |
||
| 13 | print "graph_vlabel connections\n"; |
||
| 14 | print "graph_category memcached\n"; |
||
| 15 | print "graph_info This graph monitors the connections to the memcached server.\n"; |
||
| 16 | print "connections.label connections\n"; |
||
| 17 | print "connections.info Number of connections to memcached\n"; |
||
| 18 | print "connections.min 0\n"; |
||
| 19 | print "connections.draw AREA\n"; |
||
| 20 | exit 0; |
||
| 21 | } |
||
| 22 | |||
| 23 | $0 =~ /memcached_connections_(\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 "connections.value " . |
||
| 32 | $memstats->{hosts}->{$address}->{misc}->{curr_connections} . "\n"; |
