]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/files/default/plugins/rrdcached
Rework api_calls_num using API statistics and enable it again
[chef.git] / cookbooks / munin / files / default / plugins / rrdcached
1 #!/usr/bin/perl
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 rrdcached stats\n";
14         print "QueueLength.label Queue length\n";
15         print "UpdatesReceived.label UpdatesReceived\n";
16         print "UpdatesReceived.type DERIVE\n";
17         print "FlushesReceived.label FlushesReceived\n";
18         print "FlushesReceived.type DERIVE\n";
19         print "UpdatesWritten.label UpdatesWritten\n";
20         print "UpdatesWritten.type DERIVE\n";
21         print "DataSetsWritten.label DataSetsWritten\n";
22         print "DataSetsWritten.type DERIVE\n";
23         print "TreeNodesNumber.label TreeNodesNumber\n";
24         print "TreeDepth.label TreeDepth\n";
25         print "JournalBytes.label JournalBytes\n";
26         print "JournalBytes.type DERIVE\n";
27         print "JournalRotate.label JournalRotate\n";
28         print "JournalRotate.type DERIVE\n";
29         exit 0;
30 }
31
32 my $sock = new IO::Socket::UNIX(
33         Type => SOCK_STREAM,
34         Peer => "/var/run/rrdcached.sock",
35 ) or die "Cannot open socket : $!";
36
37 print $sock "STATS\n";
38 print $sock "QUIT\n";
39
40 # skip first line
41 <$sock>;
42 print map { s/: /.value /; $_; } <$sock>;
43
44 exit 0;