From 74c8b337ded8bca117fef75ce88014e1fd80ebf1 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Thu, 23 May 2013 15:43:03 +0200 Subject: [PATCH] plugins/backuppc: Initial add --- plugins/backuppc/backuppc | 123 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100755 plugins/backuppc/backuppc diff --git a/plugins/backuppc/backuppc b/plugins/backuppc/backuppc new file mode 100755 index 00000000..1e3b4dea --- /dev/null +++ b/plugins/backuppc/backuppc @@ -0,0 +1,123 @@ +#! /bin/sh +# Copyright (C) 2013 - LGPL - Steve Schnepp +# +# [backuppc] +# user backuppc +# env.pcdir /var/lib/BackupPC/pc +# +#%# family=backuppc +#%# capabilities=autoconf + +PCDIR=${pcdir:-"/var/lib/BackupPC/pc"} +HOSTS=$(cd ${PCDIR} 2>/dev/null && ls -1) + +if [ "$1" = "autoconf" ]; then + [ ! -z "${HOSTS}" ] && echo "yes" && exit 0 + echo "no" + exit 1 +fi + +if [ "$1" = "config" ]; then + echo "multigraph backuppc_sizes" + echo "graph_title Last BackupPC Sizes" + echo "graph_args --base 1024 -l 0" + echo "graph_vlabel Bytes" + echo "graph_category Backuppc" + + for h in ${HOSTS} + do + echo "${h}.label ${h}" + done + + exit 0 +fi + +for h in $HOSTS +do + SIZE=$(awk '{ size = $6 } END { print size; }' ${PCDIR}/${h}/backups) + echo "${h}.value $SIZE" +done + +<<'__END__' + +Extract for the BackupPC doc, http://backuppc.sourceforge.net/faq/BackupPC.html + +"backups" is a tab-delimited ascii table listing information about each successful +backup, one per row. The columns are: + + num + The backup number, an integer that starts at 0 and increments for each + successive backup. The corresponding backup is stored in the directory + num (eg: if this field is 5, then the backup is stored in + __TOPDIR__/pc/$host/5). + + type + Set to "full" or "incr" for full or incremental backup. + + startTime + Start time of the backup in unix seconds. + + endTime + Stop time of the backup in unix seconds. + + nFiles + Number of files backed up (as reported by smbclient, tar, rsync or +ftp). + + size + Total file size backed up (as reported by smbclient, tar, rsync or +ftp). + + nFilesExist + Number of files that were already in the pool (as determined by + BackupPC_dump and BackupPC_link). + + sizeExist + Total size of files that were already in the pool (as determined by + BackupPC_dump and BackupPC_link). + + nFilesNew + Number of files that were not in the pool (as determined by + BackupPC_link). + + sizeNew + Total size of files that were not in the pool (as determined by + BackupPC_link). + + xferErrs + Number of errors or warnings from smbclient, tar, rsync or ftp. + + xferBadFile + Number of errors from smbclient that were bad file errors (zero + otherwise). + + xferBadShare + Number of errors from smbclient that were bad share errors (zero + otherwise). + + tarErrs + Number of errors from BackupPC_tarExtract. + + compress + The compression level used on this backup. Zero or empty means no + compression. + + sizeExistComp + Total compressed size of files that were already in the pool (as + determined by BackupPC_dump and BackupPC_link). + + sizeNewComp + Total compressed size of files that were not in the pool (as determined + by BackupPC_link). + + noFill + Set if this backup has not been filled in with the most recent previous + filled or full backup. See $Conf{IncrFill}. + + fillFromNum + If this backup was filled (ie: noFill is 0) then this is the number of + the backup that it was filled from + + mangle + Set if this backup has mangled file names and attributes. Always true + for backups in v1.4.0 and above. False for all backups prior to v1.4.0.