From fae29e0736b1c602845e3796d402def7fcc3e37a Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 21 May 2006 01:47:24 +0000 Subject: Add backuppc git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@101 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- munin/backuppc | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100755 munin/backuppc (limited to 'munin') diff --git a/munin/backuppc b/munin/backuppc new file mode 100755 index 0000000..c7e7e9d --- /dev/null +++ b/munin/backuppc @@ -0,0 +1,109 @@ +#!/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. +# +# Plugin to monitor size amount of backups with bacckuppc tool +# + +###### +# Downloaded by Peter Palfrader, 2006-05-15 +# from http://rodolphe.quiedeville.org/hack/munin/backuppc/backuppc +# + +# $Log$ +# Revision 1.2 2006/04/27 11:33:19 rodo +# Bugfix in variable definition +# +# Revision 1.1 2006/03/09 14:12:19 rodo +# Created by Rodolphe Quiedeville +# +# Parameters: +# +# autoconf (optional - used by munin-config) +# +# Magic markers (optinal - used by munin-config and some installation +# scripts): +# +#%# family=backuppc +#%# capabilities=autoconf + +use strict; + +my $pcdir = "/var/lib/backuppc/pc"; + + +if($ARGV[0] and $ARGV[0] eq "autoconf" ) { + if(-d $pcdir) { + if(-r $pcdir) { + print "yes\n"; + exit 0; + } else { + print "no (logfile not readable)\n"; + } + } else { + print "no (logfile not found)\n"; + } + exit 1; +} + +if ($ARGV[0] and $ARGV[0] eq "config" ){ + print "graph_title Backuppc\n"; + print "graph_args --base 1024 -l 0\n"; + print "graph_scale yes\n"; + print "graph_category Backuppc\n"; + print 'graph_info Plugin available at http://rodolphe.quiedeville.org/hack/munin/'."\n"; + + opendir(PCD, $pcdir) || die "Can't open $pcdir: $!"; + while (my $file = readdir(PCD)) + { + if ($file ne '..' && $file ne '.') + { + my @o = (split '\.', $file); + print $o[0].".label ".$o[0]."\n"; + print $o[0].".info $file\n"; + } + + } + closedir(PCD); + exit 0; +} + +opendir(PCD, $pcdir) || die "Can't open $pcdir: $!"; +my ($file,$size,@o) = (0,0,0); + +while (defined ($file = readdir(PCD))) +{ + $size=0; + if ($file ne '..' && $file ne '.') + { + @o = (split '\.', $file); + + open(FLOG, $pcdir.'/'.$file.'/LOG') or exit 4; + + while () + { + $size = $1 if (/.*full backup [0-9]+ complete, [0-9]+ files, ([0-9]+) bytes,.*/); + } + close(FLOG); + + print $o[0].".value ".$size."\n"; + } +} +closedir(PCD); -- cgit v1.2.3