]> git.openstreetmap.org Git - chef.git/commitdiff
Add munin plugin to monitor rrdcached
authorTom Hughes <tom@compton.nu>
Sat, 14 Mar 2015 16:09:58 +0000 (16:09 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 14 Mar 2015 16:09:58 +0000 (16:09 +0000)
cookbooks/munin/files/default/plugins/munin_rrdcached [new file with mode: 0644]
cookbooks/munin/recipes/server.rb

diff --git a/cookbooks/munin/files/default/plugins/munin_rrdcached b/cookbooks/munin/files/default/plugins/munin_rrdcached
new file mode 100644 (file)
index 0000000..9f9cb6d
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/perl -w
+# -*- cperl -*-
+
+use strict;
+use warnings;
+
+use IO::Socket::UNIX;
+
+$| = 1;
+
+my $arg = shift;
+if ($arg && $arg eq "config") {
+       print "graph_title Munin rrdcached statistics\n";
+       print "graph_category munin\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;
index 84c739e49caa6f4eaec49fdb484f8c2ced74d78e..8d9759960c21d85735e12637464ffbcaec2b81d4 100644 (file)
@@ -72,3 +72,4 @@ end
 
 munin_plugin "munin_stats"
 munin_plugin "munin_update"
+munin_plugin "munin_rrdcached"