mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 18:38:30 +00:00
change to either show an improved title: either host:ip or a title configured in munin plugin configuration, this helps a lot when monitoring multiple memcached bins
This commit is contained in:
parent
a4999d9616
commit
506459297e
1 changed files with 8 additions and 6 deletions
|
@ -6,9 +6,16 @@ use warnings;
|
||||||
|
|
||||||
use Cache::Memcached;
|
use Cache::Memcached;
|
||||||
|
|
||||||
|
$0 =~ /memcached_requests_(\d+_\d+_\d+_\d+)_(\d+)$/;
|
||||||
|
my ($ip, $port) = ($1, $2);
|
||||||
|
$ip =~ s/_/./g;
|
||||||
|
my $address = "$ip:$port";
|
||||||
|
|
||||||
|
my $title = $ENV{title} || $address;
|
||||||
|
|
||||||
my $cmd = shift || '';
|
my $cmd = shift || '';
|
||||||
if ($cmd eq 'config') {
|
if ($cmd eq 'config') {
|
||||||
print "graph_title Memcached requests\n";
|
print "graph_title Memcached requests -- $title\n";
|
||||||
print "graph_args --base 1000 -l 0\n";
|
print "graph_args --base 1000 -l 0\n";
|
||||||
print "graph_vlabel requests\n";
|
print "graph_vlabel requests\n";
|
||||||
print "graph_category memcached\n";
|
print "graph_category memcached\n";
|
||||||
|
@ -26,11 +33,6 @@ if ($cmd eq 'config') {
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$0 =~ /memcached_requests_(\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 $memd = new Cache::Memcached { 'servers' => [$address] };
|
||||||
my $memstats = $memd->stats(['misc']);
|
my $memstats = $memd->stats(['misc']);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue