mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Initial version
This commit is contained in:
parent
cf3e168706
commit
5c30a6391b
1 changed files with 39 additions and 0 deletions
39
plugins/other/memcached_traffic_
Executable file
39
plugins/other/memcached_traffic_
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env perl
|
||||
# ex:ts=4
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Cache::Memcached;
|
||||
|
||||
my $cmd = shift || '';
|
||||
if ($cmd eq 'config') {
|
||||
print "graph_title Memcached network traffic\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel bits per \${graph_period}\n";
|
||||
print "graph_category memcached\n";
|
||||
print "graph_info This graph monitors the network traffic of the memcached server.\n";
|
||||
print "up.label bits in\n";
|
||||
print "up.info Traffic received by memcached\n";
|
||||
print "up.min 0\n";
|
||||
print "up.cdef up,8,*\n";
|
||||
print "up.type COUNTER\n";
|
||||
print "up.draw AREA\n";
|
||||
print "down.label bits out\n";
|
||||
print "down.info Traffic sent by memcached\n";
|
||||
print "down.min 0\n";
|
||||
print "down.cdef down,8,*\n";
|
||||
print "down.type COUNTER\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
$0 =~ /memcached_traffic_(\d+_\d+_\d+_\d+)_(\d+)$/;
|
||||
my ($ip, $port) = ($1, $2);
|
||||
$ip =~ s/_/./g;
|
||||
my $address = "$ip:$port";
|
||||
|
||||
my $memd = new Cache::Memcached { 'servers' => [$address] };
|
||||
my $memstats = $memd->stats(['misc']);
|
||||
|
||||
print "up.value " . $memstats->{hosts}->{$address}->{misc}->{bytes_read} . "\n";
|
||||
print "down.value " . $memstats->{hosts}->{$address}->{misc}->{bytes_written} . "\n";
|
Loading…
Add table
Add a link
Reference in a new issue