opnsense-ports/sysutils/backuppc/files/extra-patch-bin-BackupPC
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

50 lines
1.3 KiB
Text

--- bin/BackupPC.orig 2011-04-25 07:31:54.000000000 +0400
+++ bin/BackupPC 2013-02-17 16:51:18.000000000 +0400
@@ -1198,6 +1198,47 @@
$Info{"${p}FileRepMax"},
$Info{"${p}FileLinkMax"}, $Info{"${p}DirCnt"});
}
+
+ #
+ # RRDTool Graphing stuff
+ #
+ if ( -x "$BinDir/rrdtool" ) {
+ my $date = time() + (24 * 3600);
+ if ( ! -f "$LogDir/pool.rrd" ) {
+ system("$BinDir/rrdtool create $LogDir/pool.rrd"
+ . " --step 86400"
+ . " DS:ckb:GAUGE:172800:0:U"
+ . " DS:tps:GAUGE:172800:0:U"
+ . " RRA:AVERAGE:0.5:1:1400"
+ );
+ }
+
+ #
+ # Generate size totals prior to poolng and compression
+ #
+ my $sizeTot;
+ foreach my $host ( sort(keys(%{$bpc->HostInfoRead()})) ) {
+ my @Backups = $bpc->BackupInfoRead($host);
+ for ( my $i = 0 ; $i < @Backups ; $i++ ) {
+ $sizeTot += $Backups[$i]{size};
+ }
+ }
+
+ $sizeTot = $sizeTot / 1024;
+
+ system("$BinDir/rrdtool update $LogDir/pool.rrd"
+ . " $date:"
+ . ( $Info{"cpoolKb"} + $Info{"poolKb"} )
+ . ":$sizeTot"
+ );
+
+ printf(LOG "%sRRD Data: %s:%f:%f\n",
+ $bpc->timeStamp,
+ $date,
+ $Info{"cpoolKb"} + $Info{"poolKb"},
+ $sizeTot);
+ }
+
}
} else {
$CmdJob = "";