From 74c8b337ded8bca117fef75ce88014e1fd80ebf1 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Thu, 23 May 2013 15:43:03 +0200 Subject: [PATCH 1/4] 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. From d69bc45ad5be8cb450b93908f6240ac10ef8b536 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Thu, 23 May 2013 17:06:44 +0200 Subject: [PATCH 2/4] plugins/backuppc: fix multigraph --- plugins/backuppc/backuppc | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/backuppc/backuppc b/plugins/backuppc/backuppc index 1e3b4dea..eb559feb 100755 --- a/plugins/backuppc/backuppc +++ b/plugins/backuppc/backuppc @@ -32,6 +32,7 @@ if [ "$1" = "config" ]; then exit 0 fi +echo "multigraph backuppc_sizes" for h in $HOSTS do SIZE=$(awk '{ size = $6 } END { print size; }' ${PCDIR}/${h}/backups) From 8e45b339dee04b6b7cdc55a1165bfaf9a376db9a Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Thu, 23 May 2013 17:24:17 +0200 Subject: [PATCH 3/4] plugins/backuppc: adding backup ages --- plugins/backuppc/backuppc | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/plugins/backuppc/backuppc b/plugins/backuppc/backuppc index eb559feb..e1836ef8 100755 --- a/plugins/backuppc/backuppc +++ b/plugins/backuppc/backuppc @@ -19,7 +19,7 @@ fi if [ "$1" = "config" ]; then echo "multigraph backuppc_sizes" - echo "graph_title Last BackupPC Sizes" + echo "graph_title BackupPC - Last Backup Size" echo "graph_args --base 1024 -l 0" echo "graph_vlabel Bytes" echo "graph_category Backuppc" @@ -29,6 +29,18 @@ if [ "$1" = "config" ]; then echo "${h}.label ${h}" done + echo "multigraph backuppc_ages" + echo "graph_title BackupPC - Last Backup Age" + echo "graph_args -l 0" + echo "graph_vlabel days" + echo "graph_category Backuppc" + + for h in ${HOSTS} + do + echo "${h}_full.label ${h}" + echo "${h}_incr.label ${h}" + done + exit 0 fi @@ -39,17 +51,28 @@ do echo "${h}.value $SIZE" done +echo "multigraph backuppc_ages" +for h in $HOSTS +do + SIZE=$(awk '/full/ { age = systime() - $3 } END { print age / 3600 / 24; }' ${PCDIR}/${h}/backups) + echo "${h}_full.value $SIZE" + SIZE=$(awk '/incr/ { age = systime() - $3 } END { print age / 3600 / 24; }' ${PCDIR}/${h}/backups) + echo "${h}_incr.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: +backups + +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 + 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 @@ -63,11 +86,11 @@ backup, one per row. The columns are: nFiles Number of files backed up (as reported by smbclient, tar, rsync or -ftp). + ftp). size Total file size backed up (as reported by smbclient, tar, rsync or -ftp). + ftp). nFilesExist Number of files that were already in the pool (as determined by @@ -86,7 +109,7 @@ ftp). BackupPC_link). xferErrs - Number of errors or warnings from smbclient, tar, rsync or ftp. + Number of errors or warnings from smbclient, tar, rsync or ftp. xferBadFile Number of errors from smbclient that were bad file errors (zero From 722c224956fd279e65e2b59601db9fa76e88d104 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Thu, 23 May 2013 17:29:09 +0200 Subject: [PATCH 4/4] plugins/backuppc: differential in size for full/incr --- plugins/backuppc/backuppc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/backuppc/backuppc b/plugins/backuppc/backuppc index e1836ef8..2d26198f 100755 --- a/plugins/backuppc/backuppc +++ b/plugins/backuppc/backuppc @@ -26,7 +26,8 @@ if [ "$1" = "config" ]; then for h in ${HOSTS} do - echo "${h}.label ${h}" + echo "${h}_full.label ${h} Full" + echo "${h}_incr.label ${h} Incr" done echo "multigraph backuppc_ages" @@ -37,8 +38,8 @@ if [ "$1" = "config" ]; then for h in ${HOSTS} do - echo "${h}_full.label ${h}" - echo "${h}_incr.label ${h}" + echo "${h}_full.label ${h} Full" + echo "${h}_incr.label ${h} Incr" done exit 0 @@ -47,8 +48,10 @@ fi echo "multigraph backuppc_sizes" for h in $HOSTS do - SIZE=$(awk '{ size = $6 } END { print size; }' ${PCDIR}/${h}/backups) - echo "${h}.value $SIZE" + SIZE=$(awk '/full/ { size = $6 } END { print size; }' ${PCDIR}/${h}/backups) + echo "${h}_full.value $SIZE" + SIZE=$(awk '/incr/ { size = $6 } END { print size; }' ${PCDIR}/${h}/backups) + echo "${h}_incr.value $SIZE" done echo "multigraph backuppc_ages"