#!/usr/bin/perl -w # # Copyright (C) 2006 Rodolphe Quiedeville # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 dated June, # 1991. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # If you improve this script please send your version to my email address # with the copyright notice upgrade with your name. # # Wildcard-plugin to monitor the ccache stats. To monitor an # user cache, link ccache_ to this file. E.g. # # ln -s /usr/share/munin/plugins/ccache_ /etc/munin/plugins/ccache_loic # # ...will monitor loic ccache stats. # # $Log$ # Revision 1.0 2006/04/27 14:12:19 rodo # Created by Rodolphe Quiedeville # # Configurable variables # # ccache - Override default ccache command # ccache_dir - Override default cache dir # # Magic markers (optinal - used by munin-config and some installation # scripts): # #%# family=compilation #%# capabilities=autoconf use strict; my $CCACHE = exists $ENV{'distccmon'} ? $ENV{'distccmon'} : "/usr/bin/distccmon-text"; my $command = "$CCACHE -s|"; $command = "/home/www/rodolphe.quiedeville.org/htdocs/hack/munin/distcc/dev/output.9"; (-x $CCACHE) || die "Can't exec $CCACHE\n"; # 5124 Blocked [0] # 5123 Blocked [0] # 5044 Compile gus_reset.c gavrinis[0] # 5058 Compile request_sock.c gavrinis[1] # 5062 Preprocess vxfs_lookup.c gavrinis[2] # 5106 Compile xattr_trusted.c gavrinis[3] # 5039 Compile xattr.c lern[0] # 4907 Compile hash.c lern[2] my @HOSTS = ("lern","gavrinis","mouchiouse","godec"); my %DATAS; foreach my $host (@HOSTS) { $DATAS{$host} = 0; } if ($ARGV[0] and $ARGV[0] eq "config" ){ print "graph_title distcc\n"; print "graph_args --base 1000 -l 0\n"; print "graph_scale yes\n"; print "graph_vlabel files\n"; print "graph_category compilation\n"; print 'graph_info Plugin available at http://rodolphe.quiedeville.org/hack/munin/'."\n"; my ($num) = (0); foreach my $host (@HOSTS) { print("$host.label $host\n"); #print("$WANTED{$k}.type DERIVE\n"); ($num > 0) ? print("$host.draw STACK\n") : print("$host.draw AREA\n"); $num++; } exit 0; } open(CCH, "$command") or exit 4; while () { my ($c,$k) = (/\s+\d+\s+(\w+).*?(\w+)\[\d+\]$/); next unless ($k); $DATAS{$k}++; $k =~ s/\s+$//; } close(CCH); foreach my $host (@HOSTS) { print("$host.label ".$DATAS{$host}."\n"); }