]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/files/default/plugins/munin_rrdcached
Fix munin replication plugin to work with osmium based state
[chef.git] / cookbooks / munin / files / default / plugins / munin_rrdcached
1 #!/usr/bin/perl -w
2 # -*- cperl -*-
3
4 use strict;
5 use warnings;
6
7 use IO::Socket::UNIX;
8
9 $| = 1;
10
11 my $arg = shift;
12 if ($arg && $arg eq "config") {
13         print "graph_title Munin rrdcached statistics\n";
14         print "graph_category munin\n";
15         print "QueueLength.label Queue length\n";
16         print "UpdatesReceived.label UpdatesReceived\n";
17         print "UpdatesReceived.type DERIVE\n";
18         print "FlushesReceived.label FlushesReceived\n";
19         print "FlushesReceived.type DERIVE\n";
20         print "UpdatesWritten.label UpdatesWritten\n";
21         print "UpdatesWritten.type DERIVE\n";
22         print "DataSetsWritten.label DataSetsWritten\n";
23         print "DataSetsWritten.type DERIVE\n";
24         print "TreeNodesNumber.label TreeNodesNumber\n";
25         print "TreeDepth.label TreeDepth\n";
26         print "JournalBytes.label JournalBytes\n";
27         print "JournalBytes.type DERIVE\n";
28         print "JournalRotate.label JournalRotate\n";
29         print "JournalRotate.type DERIVE\n";
30         exit 0;
31 }
32
33 my $sock = new IO::Socket::UNIX(
34         Type => SOCK_STREAM,
35         Peer => "/var/run/rrdcached.sock",
36 ) or die "Cannot open socket : $!";
37
38 print $sock "STATS\n";
39 print $sock "QUIT\n";
40
41 # skip first line
42 <$sock>;
43 print map { s/: /.value /; $_; } <$sock>;
44
45 exit 0;