ports/85985: [NEW PORT] mail/couriergraph: A RRDtool frontend for Courier statistics

Xavier Beaudouin kiwi at oav.net
Sun Sep 11 20:00:45 UTC 2005


>Number:         85985
>Category:       ports
>Synopsis:       [NEW PORT] mail/couriergraph: A RRDtool frontend for Courier statistics
>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:   Sun Sep 11 20:00:43 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Xavier Beaudouin
>Release:        FreeBSD 5.4-RELEASE-p1 i386
>Organization:
Association KAZAR / The Caudium Group
>Environment:
System: FreeBSD proxy.home.oav.net 5.4-RELEASE-p1 FreeBSD 5.4-RELEASE-p1 #1: Sat May 14 15:27:19 CEST 2005
>Description:
Couriergraph is a very simple mail statistics RRDtool frontend for Postfix
that produces daily, weekly, monthly and yearly graphs of Courier's POP3,
IMAP, POP3s and IMAPs logins.

WWW: http://www.stahl.bau.tu-bs.de/~hildeb/postfix/couriergraph/

Generated with FreeBSD Port Tools 0.63
>How-To-Repeat:
>Fix:

--- couriergraph-20041207.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	couriergraph
#	couriergraph/files
#	couriergraph/files/couriergraph.sh.in
#	couriergraph/files/patch-ac
#	couriergraph/files/patch-ad
#	couriergraph/files/patch-ab
#	couriergraph/files/patch-aa
#	couriergraph/Makefile
#	couriergraph/distinfo
#	couriergraph/pkg-descr
#	couriergraph/pkg-message
#	couriergraph/pkg-plist
#
echo c - couriergraph
mkdir -p couriergraph > /dev/null 2>&1
echo c - couriergraph/files
mkdir -p couriergraph/files > /dev/null 2>&1
echo x - couriergraph/files/couriergraph.sh.in
sed 's/^X//' >couriergraph/files/couriergraph.sh.in << 'END-of-couriergraph/files/couriergraph.sh.in'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X# PROVIDE: couriergraph
X# REQUIRE: DAEMON
X# KEYWORD: FreeBSD
X#
X# Add the following line to /etc/rc.conf to enable mailgraph:
X#
X# couriergraph_enable="YES"
X#
X
X. %%RC_SUBR%%
X
Xname=couriergraph
Xrcvar=`set_rcvar`
X
Xcommand=%%PREFIX%%/sbin/couriergraph.pl > /dev/null 2>&1
Xcommand_interpreter=/usr/bin/perl
Xstop_postcmd=stop_postcmd
X
Xstop_postcmd()
X{
X    rm -f $pidfile
X}
X
Xcouriergraph_enable=${couriergraph_enable:-"NO"}
Xcouriergraph_pidfile=${couriergraph_pidfile:-"%%DATADIR%%/couriergraph.pid"}
Xcouriergraph_flags=${couriergraph_flags:-"--logfile /var/log/maillog --daemon-rrd=%%DATADIR%% --daemon --daemon-pid=${couriergraph_pidfile}"}
Xcouriergraph_user=${couriergraph_user:-"%%COURIERGRAPH_USER%%"}
Xcouriergraph_group=${couriergraph_group:-"%%COURIERGRAPH_GROUP%%"}
Xcouriergraph_chdir=${couriergraph_chdir:-"%%DATADIR%%"}
X
Xload_rc_config $name
X
Xpidfile=${couriergraph_pidfile}
X
Xrun_rc_command "$1"
END-of-couriergraph/files/couriergraph.sh.in
echo x - couriergraph/files/patch-ac
sed 's/^X//' >couriergraph/files/patch-ac << 'END-of-couriergraph/files/patch-ac'
X--- couriergraph.pl.orig	Sun Sep 11 20:47:01 2005
X+++ couriergraph.pl	Sun Sep 11 20:48:30 2005
X@@ -314,11 +314,11 @@
X 
X my $daemon_logfile = '/var/log/couriergraph.log';
X my $daemon_pidfile = '/var/run/couriergraph.pid';
X-my $daemon_rrd_dir = '/var/log';
X+my $daemon_rrd_dir = '%%DATADIR%%';
X 
X # global variables
X my $logfile;
X-my $rrd = "/etc/postfix/couriergraph.rrd";
X+my $rrd = "couriergraph.rrd";
X my $year;
X my $this_minute;
X my %sum = ( imapd_ssl_login => 0, imapd_login => 0, pop3d_ssl_login => 0, pop3d_login => 0 );
X@@ -350,7 +350,7 @@
X 	print "      --host=HOST    use only entries for HOST (regexp) in syslog\n";
X 	print "  -d, --daemon       start in the background\n";
X 	print "  --daemon-pid=FILE  write PID to FILE instead of /var/run/mailgraph.pid\n";
X-	print "  --daemon-rrd=DIR   write RRDs to DIR instead of /var/log\n";
X+	print "  --daemon-rrd=DIR   write RRDs to DIR instead of %%DATADIR%%\n";
X 	print "  --daemon-log=FILE  write verbose-log to FILE instead of /var/log/mailgraph.log\n";
X 	print "  --rrd-name=NAME    use NAME.rrd for the rrd files\n";
X 
END-of-couriergraph/files/patch-ac
echo x - couriergraph/files/patch-ad
sed 's/^X//' >couriergraph/files/patch-ad << 'END-of-couriergraph/files/patch-ad'
X--- couriergraph.pl.orig	Sun Sep 11 21:34:13 2005
X+++ couriergraph.pl	Sun Sep 11 21:35:17 2005
X@@ -473,12 +473,12 @@
X 	my $prog = $sl->[2];
X 	my $text = $sl->[4];
X 
X- 	if ($prog eq 'courierpop3login') {
X+ 	if ($prog eq 'pop3d') {
X  		if($text =~ /LOGIN,/) {
X 		        event($time, 'pop3d_login');
X   		}
X   	}
X- 	elsif ($prog eq 'imaplogin') {
X+ 	elsif ($prog eq 'imapd') {
X  		if($text =~ /LOGIN,/) {
X 		        event($time, 'imapd_login');
X   		}
END-of-couriergraph/files/patch-ad
echo x - couriergraph/files/patch-ab
sed 's/^X//' >couriergraph/files/patch-ab << 'END-of-couriergraph/files/patch-ab'
X--- couriergraph.cgi.orig	Sun Sep 11 21:17:26 2005
X+++ couriergraph.cgi	Sun Sep 11 21:23:51 2005
X@@ -21,6 +21,7 @@
X my $rrd = '/var/db/couriergraph/couriergraph.rrd'; # path to where the RRD database is
X my $rrd_virus = '/var/db/couriergraph/couriergraph_virus.rrd'; # path to where the Virus RRD database is
X my $tmp_dir = '/tmp/couriergraph'; # temporary directory where to store the images
X+my $rrdtool_1_0 = ($RRDs::VERSION < 1.199908);
X 
X my @graphs = (
X 	{ title => 'Day Graphs',   seconds => 3600*24,        },
X@@ -44,6 +45,8 @@
X 	my $file = shift;
X 	my $title = shift;
X 	my $step = $range*$points_per_sample/$xpoints;
X+	my $date = localtime(time);
X+	$date =~ s|:|\\:|g unless $rrdtool_1_0;
X 
X 	my ($graphret,$xs,$ys) = RRDs::graph($file,
X 		'--imgformat', 'PNG',
X@@ -57,6 +60,9 @@
X 		'--color', 'SHADEA#ffffff',
X 		'--color', 'SHADEB#ffffff',
X 		'--color', 'BACK#ffffff',
X+		$rrdtool_1_0 ? () : (
X+			'--slope-mode'
X+		),
X 
X  		"DEF:pop3d_login=$rrd:pop3d_login:AVERAGE",
X  		"DEF:mpop3d_login=$rrd:pop3d_login:MAX",
X@@ -76,7 +82,7 @@
X  		'GPRINT:rmimapd_login:MAX:max\: %.0lf logins/min\l',
X   		'HRULE:0#000000',
X   		'COMMENT:\s',
X-		'COMMENT:['.localtime(time).']\l',
X+		'COMMENT:['.$date.']\l',
X 	);
X 	my $ERR=RRDs::error;
X 	die "ERROR: $ERR\n" if $ERR;
X@@ -88,6 +94,8 @@
X 	my $file = shift;
X 	my $title = shift;
X 	my $step = $range*$points_per_sample/$xpoints;
X+	my $date = localtime(time);
X+	$date =~ s|:|\\:|g unless $rrdtool_1_0;
X 
X 	my ($graphret,$xs,$ys) = RRDs::graph($file,
X 		'--imgformat', 'PNG',
X@@ -101,6 +109,9 @@
X 		'--color', 'SHADEA#ffffff',
X 		'--color', 'SHADEB#ffffff',
X 		'--color', 'BACK#ffffff',
X+		$rrdtool_1_0 ? () : (
X+			'--slope-mode',
X+		),
X 
X  		"DEF:pop3d_ssl_login=$rrd:pop3d_ssl_login:AVERAGE",
X  		"DEF:mpop3d_ssl_login=$rrd:pop3d_ssl_login:MAX",
X@@ -120,7 +131,7 @@
X  		'GPRINT:rmimapd_ssl_login:MAX:max\: %.0lf logins/hour\l',
X   		'HRULE:0#000000',
X 	    
X-		'COMMENT:['.localtime(time).']\l',
X+		'COMMENT:['.$date.']\l',
X 	);
X 	my $ERR=RRDs::error;
X 	die "ERROR: $ERR\n" if $ERR;
END-of-couriergraph/files/patch-ab
echo x - couriergraph/files/patch-aa
sed 's/^X//' >couriergraph/files/patch-aa << 'END-of-couriergraph/files/patch-aa'
X--- couriergraph.cgi.orig	Sun Sep 11 14:59:52 2005
X+++ couriergraph.cgi	Sun Sep 11 15:01:32 2005
X@@ -18,8 +18,8 @@
X my $points_per_sample = 3;
X my $ypoints = 160;
X my $ypoints_err = 96;
X-my $rrd = '/etc/postfix/couriergraph.rrd'; # path to where the RRD database is
X-my $rrd_virus = '/etc/postfix/mailgraph_virus.rrd'; # path to where the Virus RRD database is
X+my $rrd = '%%DATADIR%%/couriergraph.rrd'; # path to where the RRD database is
X+my $rrd_virus = '%%DATADIR%%/couriergraph_virus.rrd'; # path to where the Virus RRD database is
X my $tmp_dir = '/tmp/couriergraph'; # temporary directory where to store the images
X 
X my @graphs = (
END-of-couriergraph/files/patch-aa
echo x - couriergraph/Makefile
sed 's/^X//' >couriergraph/Makefile << 'END-of-couriergraph/Makefile'
X# New ports collection makefile for:	mailgraph
X# Date created:			11 September 2005
X# Whom:				Xavier Beaudouin (kiwi at oav.net)
X#
X# $FreeBSD$
X#
X
XPORTNAME=	couriergraph
XPORTVERSION=	20041207
XCATEGORIES=	mail
XMASTER_SITES=	http://www.stahl.bau.tu-bs.de/~hildeb/postfix/couriergraph/
XDISTNAME=	${PORTNAME}
X
XMAINTAINER=	kiwi at oav.net
XCOMMENT=	A RRDtool frontend for Courier statistics
X
XRUN_DEPENDS=	${SITE_PERL}/RRDp.pm:${PORTSDIR}/net/rrdtool	\
X		${SITE_PERL}/File/Tail.pm:${PORTSDIR}/devel/p5-File-Tail
X
XNO_BUILD=	yes
X
XDATADIR?=	/var/db/couriergraph
XCOURIERGRAPH_USER?=	${WWWOWN}
XCOURIERGRAPH_GROUP?=	${WWWGRP}
X
XUSE_REINPLACE=	yes
XUSE_RC_SUBR=	yes
XRC_SCRIPTS_SUB=	PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} DATADIR=${DATADIR} \
X		COURIERGRAPH_USER=${COURIERGRAPH_USER} COURIERGRAPH_GROUP=${COURIERGRAPH_GROUP}
X
XSTARTUP_FILE=	${PREFIX}/etc/rc.d/couriergraph.sh
X
XMSG_FILE=	${PKGDIR}/pkg-message
XPKGMESSAGE=	${WRKSRC}/pkg-message
X
Xpre-everything::
X	@${ECHO_MSG}
X	@${ECHO_MSG} "You may set following options:"
X	@${ECHO_MSG}
X	@${ECHO_MSG} "DATADIR=/var/db/couriergraph		Where do you put RRD databases?"
X	@${ECHO_MSG} "COURIERGRAPH_USER=www			User to run couriergraph (Default: ${WWWOWN})"
X	@${ECHO_MSG} "COURIERGRAPH_GROUP=www			Group to run couriergraph (Default: ${WWWGRP})"
X	@${ECHO_MSG}
X
Xpost-patch:
X	@${REINPLACE_CMD} -e "s,%%DATADIR%%,${DATADIR}," ${WRKSRC}/couriergraph.cgi
X	@${REINPLACE_CMD} -e "s,%%DATADIR%%,${DATADIR}," ${WRKSRC}/couriergraph.pl
X	@${SED} 's|%%DATADIR%%|${DATADIR}|g' ${MSG_FILE} > ${PKGMESSAGE}
X
Xdo-install:
X	${MKDIR} ${PREFIX}/www/cgi-bin
X	${MKDIR} ${DATADIR}
X	@${CHOWN} -R ${COURIERGRAPH_USER}:${COURIERGRAPH_GROUP} ${DATADIR}
X	@${INSTALL_SCRIPT} ${WRKSRC}/couriergraph.pl ${PREFIX}/sbin
X	@${INSTALL_SCRIPT} ${WRKSRC}/couriergraph.cgi ${PREFIX}/www/cgi-bin
X	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
X		${FILESDIR}/couriergraph.sh.in > ${STARTUP_FILE}
X	@${CHMOD} 755 ${STARTUP_FILE}
X
Xpost-install:
X	@${ECHO}
X	@${CAT} ${PKGMESSAGE}
X	@${ECHO}
X
X.include <bsd.port.mk>
END-of-couriergraph/Makefile
echo x - couriergraph/distinfo
sed 's/^X//' >couriergraph/distinfo << 'END-of-couriergraph/distinfo'
XMD5 (couriergraph.tar.gz) = fc6427650b354ff0539adc1956639801
XSIZE (couriergraph.tar.gz) = 7595
END-of-couriergraph/distinfo
echo x - couriergraph/pkg-descr
sed 's/^X//' >couriergraph/pkg-descr << 'END-of-couriergraph/pkg-descr'
XCouriergraph is a very simple mail statistics RRDtool frontend for Postfix
Xthat produces daily, weekly, monthly and yearly graphs of Courier's POP3,
XIMAP, POP3s and IMAPs logins.
X
XWWW: http://www.stahl.bau.tu-bs.de/~hildeb/postfix/couriergraph/
END-of-couriergraph/pkg-descr
echo x - couriergraph/pkg-message
sed 's/^X//' >couriergraph/pkg-message << 'END-of-couriergraph/pkg-message'
XMake sure this script should be invoked with privilege to read
X/var/log/maillog.
X
X
X*** WARNING ***
X
XThe rrd database has been moved to %%DATADIR%%.
XIf you have previous ones, please move them to %%DATADIR%%.
END-of-couriergraph/pkg-message
echo x - couriergraph/pkg-plist
sed 's/^X//' >couriergraph/pkg-plist << 'END-of-couriergraph/pkg-plist'
Xetc/rc.d/couriergraph.sh
Xwww/cgi-bin/couriergraph.cgi
Xsbin/couriergraph.pl
X at unexec rmdir %D/www/cgi-bin 2>/dev/null || true
END-of-couriergraph/pkg-plist
exit
--- couriergraph-20041207.shar ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list