mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
rewrite memcached family plugins: bytes_, connections_, hits_, items_, requests_, traffic_
for unix socket usage
This commit is contained in:
parent
13b6ca382e
commit
fb4914f77d
6 changed files with 342 additions and 0 deletions
57
plugins/memcached_ext/memcached_ext_bytes_
Executable file
57
plugins/memcached_ext/memcached_ext_bytes_
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env perl
|
||||
# ex:ts=4
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Cache::Memcached;
|
||||
|
||||
# Based on original plugin, extended to unix socket use
|
||||
# https://github.com/western, westroads@gmail.com
|
||||
|
||||
=head1 example config for /plugin-conf.d/munin-node
|
||||
|
||||
[memcached_bytes_1]
|
||||
env.server 127.0.0.1:11211
|
||||
env.label "first local server"
|
||||
|
||||
[memcached_bytes_2]
|
||||
env.server /var/run/memcached/memcached.sock
|
||||
env.label "second local server"
|
||||
|
||||
=cut
|
||||
|
||||
my $label = exists $ENV{'label'} ? $ENV{'label'} : '';
|
||||
unless( $label ){
|
||||
|
||||
if( $0 =~ /memcached_ext_bytes_([\d\w]+)$/ ){
|
||||
$label = $1;
|
||||
}
|
||||
}
|
||||
|
||||
my $cmd = shift || '';
|
||||
if ($cmd eq 'config') {
|
||||
print "graph_title Memcached bytes used on $label\n";
|
||||
print "graph_args --base 1024 -l 0\n";
|
||||
print "graph_vlabel bytes\n";
|
||||
print "graph_category memcached\n";
|
||||
print "graph_info This graph monitors the size of the memcached cache.\n";
|
||||
print "bytes.label bytes used\n";
|
||||
print "bytes.info Number of bytes currently used\n";
|
||||
print "bytes.min 0\n";
|
||||
print "bytes.draw AREA\n";
|
||||
print "maxbytes.label maximum available\n";
|
||||
print "maxbytes.info The configured cache size\n";
|
||||
print "maxbytes.min 0\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
my $server = exists $ENV{'server'} ? $ENV{'server'} : '127.0.0.1:11211';
|
||||
|
||||
my $memd = new Cache::Memcached { 'servers' => [$server] };
|
||||
my $memstats = $memd->stats(['misc']);
|
||||
|
||||
print "bytes.value " . $memstats->{hosts}->{$server}->{misc}->{bytes} . "\n";
|
||||
print "maxbytes.value " .
|
||||
$memstats->{hosts}->{$server}->{misc}->{limit_maxbytes} . "\n";
|
Loading…
Add table
Add a link
Reference in a new issue