#!/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. # # # $Log$ # Revision 1.0 2006/04/30 13:51:19 rodo # Created by Rodolphe Quiedeville # # Configurable variables # # ccache - Override default ccache command # # Magic markers (optinal - used by munin-config and some installation # scripts): # #%# family=debian #%# capabilities=autoconf use strict; my $CCACHE = exists $ENV{'ccache'} ? $ENV{'ccache'} : "/var/lib/dpkg/available"; (-r $CCACHE) || die "Can't read $CCACHE\n"; my %WANTED = (); open(CCH, "<$CCACHE") or exit 4; while () { my ($section) = (/Priority:\s(\w+)/); next unless ($section); $WANTED{$section}++; } close(CCH); if ($ARGV[0] and $ARGV[0] eq "config" ){ print "graph_title Debian available packages by priority\n"; print "graph_args --base 1000 -l 0\n"; print "graph_scale yes\n"; print "graph_vlabel packages\n"; print "graph_category debian\n"; print "graph_total total\n"; print 'graph_info Plugin available at http://rodolphe.quiedeville.org/hack/munin/'."\n"; my ($num,$section,$value) = (0,'',0); while (($section,$value) = each(%WANTED)) { print("$section.label $section\n"); ($num > 0) ? print("$section.draw STACK\n") : print("$section.draw AREA\n"); $num++; } exit 0; } my ($section,$value) = ('',0); while (($section,$value) = each(%WANTED)) { print("$section.value $value\n"); }