root / plugins / memcached / memcached_ext_bytes_ @ 09b88141
Historique | Voir | Annoter | Télécharger (1,44 ko)
| 1 | fb4914f7 | Andrey (suse24) | #!/usr/bin/env perl |
|---|---|---|---|
| 2 | # ex:ts=4 |
||
| 3 | |||
| 4 | use strict; |
||
| 5 | use warnings; |
||
| 6 | |||
| 7 | use Cache::Memcached; |
||
| 8 | |||
| 9 | # Based on original plugin, extended to unix socket use |
||
| 10 | # https://github.com/western, westroads@gmail.com |
||
| 11 | |||
| 12 | =head1 example config for /plugin-conf.d/munin-node |
||
| 13 | |||
| 14 | 09b88141 | Lars Kruse | [memcached_bytes_1] |
| 15 | env.server 127.0.0.1:11211 |
||
| 16 | env.label "first local server" |
||
| 17 | fb4914f7 | Andrey (suse24) | |
| 18 | 09b88141 | Lars Kruse | [memcached_bytes_2] |
| 19 | env.server /var/run/memcached/memcached.sock |
||
| 20 | env.label "second local server" |
||
| 21 | fb4914f7 | Andrey (suse24) | |
| 22 | =cut |
||
| 23 | |||
| 24 | my $label = exists $ENV{'label'} ? $ENV{'label'} : '';
|
||
| 25 | unless( $label ){
|
||
| 26 | 17f78427 | Lars Kruse | |
| 27 | fb4914f7 | Andrey (suse24) | if( $0 =~ /memcached_ext_bytes_([\d\w]+)$/ ){
|
| 28 | $label = $1; |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | my $cmd = shift || ''; |
||
| 33 | if ($cmd eq 'config') {
|
||
| 34 | print "graph_title Memcached bytes used on $label\n"; |
||
| 35 | print "graph_args --base 1024 -l 0\n"; |
||
| 36 | print "graph_vlabel bytes\n"; |
||
| 37 | 78b99b85 | dipohl | print "graph_category memory\n"; |
| 38 | fb4914f7 | Andrey (suse24) | print "graph_info This graph monitors the size of the memcached cache.\n"; |
| 39 | print "bytes.label bytes used\n"; |
||
| 40 | print "bytes.info Number of bytes currently used\n"; |
||
| 41 | print "bytes.min 0\n"; |
||
| 42 | print "bytes.draw AREA\n"; |
||
| 43 | print "maxbytes.label maximum available\n"; |
||
| 44 | print "maxbytes.info The configured cache size\n"; |
||
| 45 | print "maxbytes.min 0\n"; |
||
| 46 | exit 0; |
||
| 47 | } |
||
| 48 | |||
| 49 | |||
| 50 | my $server = exists $ENV{'server'} ? $ENV{'server'} : '127.0.0.1:11211';
|
||
| 51 | |||
| 52 | my $memd = new Cache::Memcached { 'servers' => [$server] };
|
||
| 53 | my $memstats = $memd->stats(['misc']); |
||
| 54 | |||
| 55 | print "bytes.value " . $memstats->{hosts}->{$server}->{misc}->{bytes} . "\n";
|
||
| 56 | print "maxbytes.value " . |
||
| 57 | $memstats->{hosts}->{$server}->{misc}->{limit_maxbytes} . "\n"; |
