From 506459297ec73c2611511ef7e4436b98ded21950 Mon Sep 17 00:00:00 2001 From: Harald Lapp Date: Wed, 1 Feb 2012 18:29:26 +0800 Subject: [PATCH] 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 --- plugins/other/memcached_requests_ | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/other/memcached_requests_ b/plugins/other/memcached_requests_ index 284617fd..b414b674 100755 --- a/plugins/other/memcached_requests_ +++ b/plugins/other/memcached_requests_ @@ -6,9 +6,16 @@ use warnings; 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 || ''; 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_vlabel requests\n"; print "graph_category memcached\n"; @@ -26,11 +33,6 @@ if ($cmd eq 'config') { 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 $memstats = $memd->stats(['misc']);