From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Feb 13 18:50:02 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9430F8B7 for ; Wed, 13 Feb 2013 18:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 75C3991D for ; Wed, 13 Feb 2013 18:50:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r1DIo1tB015925 for ; Wed, 13 Feb 2013 18:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r1DIo15c015924; Wed, 13 Feb 2013 18:50:01 GMT (envelope-from gnats) Resent-Date: Wed, 13 Feb 2013 18:50:01 GMT Resent-Message-Id: <201302131850.r1DIo15c015924@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Lawrence Chen Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 51156853 for ; Wed, 13 Feb 2013 18:44:50 +0000 (UTC) (envelope-from lchen@zen.lhaven.homeip.net) Received: from mho-02-ewr.mailhop.org (mho-04-ewr.mailhop.org [204.13.248.74]) by mx1.freebsd.org (Postfix) with ESMTP id 272428E7 for ; Wed, 13 Feb 2013 18:44:49 +0000 (UTC) Received: from ip70-179-135-19.fv.ks.cox.net ([70.179.135.19] helo=zen.lhaven.homeip.net) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1U5hJz-0007Ap-6n for FreeBSD-gnats-submit@freebsd.org; Wed, 13 Feb 2013 18:44:43 +0000 Received: from zen.lhaven.homeip.net (localhost [127.0.0.1]) by zen.lhaven.homeip.net (8.14.6/8.14.5) with ESMTP id r1DIiXfC086173; Wed, 13 Feb 2013 12:44:33 -0600 (CST) (envelope-from lchen@zen.lhaven.homeip.net) Received: (from lchen@localhost) by zen.lhaven.homeip.net (8.14.6/8.14.5/Submit) id r1DIiXwm086172; Wed, 13 Feb 2013 12:44:33 -0600 (CST) (envelope-from lchen) Message-Id: <201302131844.r1DIiXwm086172@zen.lhaven.homeip.net> Date: Wed, 13 Feb 2013 12:44:33 -0600 (CST) From: Lawrence Chen To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/176121: [patch] sysutils/backuppc: add rrdtool pool statistic graphs Cc: beastie_t@lhaven.homeip.net X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Lawrence Chen List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Feb 2013 18:50:02 -0000 >Number: 176121 >Category: ports >Synopsis: [patch] sysutils/backuppc: add rrdtool pool statistic graphs >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Feb 13 18:50:01 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Lawrence Chen >Release: FreeBSD 9.1-RELEASE amd64 >Organization: >Environment: System: FreeBSD zen.lhaven.homeip.net 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4 09:23:10 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: BackupPC under Ubuntu had pretty graphs of pool information, which is apparently an upstream patch from debian. I have adapted the rrdtool patch from the backuppc-users mailing list http://www.mail-archive.com/backuppc-users@lists.sourceforge.net/msg09451.html >How-To-Repeat: >Fix: --- patch.txt begins here --- --- Makefile.orig 2012-12-16 00:16:58.000000000 -0600 +++ Makefile 2013-02-13 12:12:00.013857443 -0600 @@ -7,6 +7,7 @@ PORTNAME= backuppc PORTVERSION= 3.2.1 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= SF MASTER_SITE_SUBDIR= ${PORTNAME}/${PORTNAME}/${PORTVERSION} @@ -39,7 +40,8 @@ FILE_RSYNCP "Perl Rsync client" off \ SMBCLIENT "Samba client" off \ NMBLOOKUP "NetBIOS Name lookup tool" off \ - XML_RSS "Perl extension to manage RSS files" off + XML_RSS "Perl extension to manage RSS files" off \ + RRDTOOL "Use RRDTool to generate pool statistic graphs" off .include @@ -61,6 +63,11 @@ .if defined(WITH_XML_RSS) RUN_DEPENDS+= p5-XML-RSS>=0:${PORTSDIR}/textproc/p5-XML-RSS .endif +.if defined(WITH_RRDTOOL) +RUN_DEPENDS+= rrdtool:${PORTSDIR}/databases/rrdtool +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bin__BackupPC \ + ${FILESDIR}/extra-patch-lib__BackupPC__CGI__GeneralInfo.pm +.endif post-patch: @${REINPLACE_CMD} \ --- files/extra-patch-bin__BackupPC.orig 1969-12-31 18:00:00.000000000 -0600 +++ files/extra-patch-bin__BackupPC 2013-02-13 12:12:12.532857364 -0600 @@ -0,0 +1,36 @@ +--- ./bin/BackupPC.orig 2011-04-24 22:31:54.000000000 -0500 ++++ ./bin/BackupPC 2013-02-13 12:02:07.917857713 -0600 +@@ -1198,6 +1198,33 @@ + $Info{"${p}FileRepMax"}, + $Info{"${p}FileLinkMax"}, $Info{"${p}DirCnt"}); + } ++ ++ # RRDTool Graphing stuff ++ if (-x "/usr/local/bin/rrdtool") { ++ my $date = time() + (24*3600); ++ if (! -f "$LogDir/pool.rrd") { ++ system("/usr/local/bin/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("/usr/local/bin/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 = ""; --- files/extra-patch-lib__BackupPC__CGI__GeneralInfo.pm.orig 1969-12-31 18:00:00.000000000 -0600 +++ files/extra-patch-lib__BackupPC__CGI__GeneralInfo.pm 2013-02-13 12:12:12.532857364 -0600 @@ -0,0 +1,35 @@ +--- ./lib/BackupPC/CGI/GeneralInfo.pm.orig 2011-04-24 22:31:55.000000000 -0500 ++++ ./lib/BackupPC/CGI/GeneralInfo.pm 2013-02-13 12:02:07.920857680 -0600 +@@ -44,6 +44,18 @@ + GetStatusInfo("info jobs hosts queueLen"); + my $Privileged = CheckPermission(); + ++ if ($In{image} ne "") { ++ $In{image} =~ /([0-9]+)/; ++ my $weeks = $1; ++ my $real = $<; ### SUID ++ $< = $>; ### SUID ++ print "Content-type: image/png\n\n"; ++ print `/usr/local/bin/rrdtool graph - --imgformat=PNG --start=end-${weeks}w --end=-300 --title="BackupPC Pool Size" --logarithmic --rigid --units=si --base=1024 --height=100 --width=600 --alt-autoscale-max --vertical-label="" --slope-mode --font TITLE:10: --font AXIS:8: --font LEGEND:8: --font UNIT:8: -c BACK#FFFFFF DEF:ao="$LogDir/pool.rrd":ckb:AVERAGE DEF:aob="$LogDir/pool.rrd":tps:AVERAGE CDEF:a=ao,1024,* CDEF:b=aob,1024,* AREA:a#95B8DB:"CPool in bytes " GPRINT:a:LAST:"Current\\:%8.2lf %s" GPRINT:a:AVERAGE:"Average\\:%8.2lf %s" GPRINT:a:MAX:"Maximum\\:%8.2lf %s\\n" LINE1:b#FF0000:"Prior to pooling and compression" GPRINT:b:LAST:"Current\\:%8.2lf %s" GPRINT:b:AVERAGE:"Average\\:%8.2lf %s" GPRINT:b:MAX:"Maximum\\:%8.2lf %s\\n"`; ++ ++ $< = $real; ### SUID ++ return; ++ } ++ + my($jobStr, $statusStr); + foreach my $host ( sort(keys(%Jobs)) ) { + my $startTime = timeStamp2($Jobs{$host}{startTime}); +@@ -126,9 +138,13 @@ + } elsif ( $Info{cpoolFileCnt} > 0 ) { + $poolInfo = $cpoolInfo; + } ++ if ( -r "$LogDir/pool.rrd") { ++ $poolInfo .= '

'; ++ } + my $generalInfo = eval("qq{$Lang->{BackupPC_Server_Status_General_Info}}") + if ( $Privileged ); + my $content = eval("qq{$Lang->{BackupPC_Server_Status}}"); ++ + Header($Lang->{H_BackupPC_Server_Status}, $content); + Trailer(); + } --- patch.txt ends here --- >Release-Note: >Audit-Trail: >Unformatted: