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