diff options
author | Peter Palfrader <peter@palfrader.org> | 2006-05-21 01:47:24 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2006-05-21 01:47:24 +0000 |
commit | fae29e0736b1c602845e3796d402def7fcc3e37a (patch) | |
tree | f49b016b067dd54d7be224d957b0c0bc45ff83f0 /munin/backuppc | |
parent | 37c995313aa7e5164572473aaa1473d7e7de7f3b (diff) |
Add backuppc
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@101 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'munin/backuppc')
-rwxr-xr-x | munin/backuppc | 109 |
1 files changed, 109 insertions, 0 deletions
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 <rodolphe@quiedeville.org> +# +# 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 <a href="http://rodolphe.quiedeville.org/hack/munin/">http://rodolphe.quiedeville.org/hack/munin/</a>'."\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 (<FLOG>) + { + $size = $1 if (/.*full backup [0-9]+ complete, [0-9]+ files, ([0-9]+) bytes,.*/); + } + close(FLOG); + + print $o[0].".value ".$size."\n"; + } +} +closedir(PCD); |