From: Tom Hughes Date: Tue, 2 Sep 2014 20:45:12 +0000 (+0100) Subject: Add munin monitoring of rrdcached X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/fa135dc6a032a354ffb78b72947cb2b6be2910cd Add munin monitoring of rrdcached --- diff --git a/cookbooks/munin/files/default/plugins/rrdcached b/cookbooks/munin/files/default/plugins/rrdcached new file mode 100644 index 000000000..ff18a9a7b --- /dev/null +++ b/cookbooks/munin/files/default/plugins/rrdcached @@ -0,0 +1,44 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; +use warnings; + +use IO::Socket::UNIX; + +$| = 1; + +my $arg = shift; +if ($arg && $arg eq "config") { + print "graph_title rrdcached stats\n"; + print "QueueLength.label Queue length\n"; + print "UpdatesReceived.label UpdatesReceived\n"; + print "UpdatesReceived.type DERIVE\n"; + print "FlushesReceived.label FlushesReceived\n"; + print "FlushesReceived.type DERIVE\n"; + print "UpdatesWritten.label UpdatesWritten\n"; + print "UpdatesWritten.type DERIVE\n"; + print "DataSetsWritten.label DataSetsWritten\n"; + print "DataSetsWritten.type DERIVE\n"; + print "TreeNodesNumber.label TreeNodesNumber\n"; + print "TreeDepth.label TreeDepth\n"; + print "JournalBytes.label JournalBytes\n"; + print "JournalBytes.type DERIVE\n"; + print "JournalRotate.label JournalRotate\n"; + print "JournalRotate.type DERIVE\n"; + exit 0; +} + +my $sock = new IO::Socket::UNIX( + Type => SOCK_STREAM, + Peer => "/var/run/rrdcached.sock", +) or die "Cannot open socket : $!"; + +print $sock "STATS\n"; +print $sock "QUIT\n"; + +# skip first line +<$sock>; +print map { s/: /.value /; $_; } <$sock>; + +exit 0; diff --git a/cookbooks/munin/recipes/server.rb b/cookbooks/munin/recipes/server.rb index 983f92231..0c74cd0cc 100644 --- a/cookbooks/munin/recipes/server.rb +++ b/cookbooks/munin/recipes/server.rb @@ -40,6 +40,8 @@ service "rrdcached" do subscribes :restart, "template[/etc/default/rrdcached]" end +munin_plugin "rrdcached" + expiry_time = 14 * 86400 clients = search(:node, "recipes:munin").select { |n| n[:munin] }.sort_by { |n| n[:hostname] }