From 5dd90f05f95fb61c9754f9a23b0509e8ae459995 Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Mon, 26 Nov 2007 16:53:18 +0100 Subject: [PATCH] Initial version --- plugins/other/memcached_connections_ | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 plugins/other/memcached_connections_ diff --git a/plugins/other/memcached_connections_ b/plugins/other/memcached_connections_ new file mode 100755 index 00000000..55c3e051 --- /dev/null +++ b/plugins/other/memcached_connections_ @@ -0,0 +1,32 @@ +#!/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 connections\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel connections\n"; + print "graph_category memcached\n"; + print "graph_info This graph monitors the connections to the memcached server.\n"; + print "connections.label connections\n"; + print "connections.info Number of connections to memcached\n"; + print "connections.min 0\n"; + print "connections.draw AREA\n"; + exit 0; +} + +$0 =~ /memcached_connections_(\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 "connections.value " . + $memstats->{hosts}->{$address}->{misc}->{curr_connections} . "\n";