diff --git a/.cvsignore b/.cvsignore index e69de29..1493802 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +queuegraph.tar.gz diff --git a/queuegraph-average.patch b/queuegraph-average.patch new file mode 100644 index 0000000..a305ccb --- /dev/null +++ b/queuegraph-average.patch @@ -0,0 +1,11 @@ +--- queuegraph/queuegraph/queuegraph-rrd.sh.orig 2007-02-12 02:37:40.000000000 -0700 ++++ queuegraph/queuegraph/queuegraph-rrd.sh 2007-03-25 23:07:38.000000000 -0600 +@@ -27,7 +27,7 @@ + $RRDTOOL create $RRDFILE --step 60 \ + DS:active:GAUGE:900:0:U \ + DS:deferred:GAUGE:900:0:U \ +- RRA:AVERAGE:0.5:1:20160 \ ++ RRA:AVERAGE:0.5:1:1440 \ + RRA:AVERAGE:0.5:30:2016 \ + RRA:AVERAGE:0.5:60:105120 \ + RRA:MAX:0.5:1:1440 \ diff --git a/queuegraph-paths.patch b/queuegraph-paths.patch new file mode 100644 index 0000000..386820f --- /dev/null +++ b/queuegraph-paths.patch @@ -0,0 +1,43 @@ +--- quegraph/queuegraph/queuegraph-rrd.sh.orig 2007-02-12 02:37:40.000000000 -0700 ++++ quegraph/queuegraph/queuegraph-rrd.sh 2007-03-25 21:06:32.000000000 -0600 +@@ -14,7 +14,7 @@ + # change this to the location of rrdtool + RRDTOOL=/usr/bin/rrdtool + # change this to the location you want to store the rrd +-RRDFILE=/etc/postfix/mailqueues.rrd ++RRDFILE=/var/lib/queuegraph/mailqueues.rrd + + if test ! -x $RRDTOOL ; then + echo "ERROR: $RRDTOOL does not exist or is not executable" +--- queuegraph/queuegraph.cgi.orig 2005-10-24 03:27:09.000000000 -0600 ++++ queuegraph/queuegraph.cgi 2007-03-25 21:53:38.000000000 -0600 +@@ -16,8 +16,8 @@ + my $points_per_sample = 3; + my $ypoints = 160; + my $ypoints_err = 80; +-my $rrd = '/etc/postfix/mailqueues.rrd'; # path to where the RRD database is +-my $tmp_dir = '/tmp/queuegraph'; # temporary directory where to store the images ++my $rrd = '/var/lib/queuegraph/mailqueues.rrd'; # path to where the RRD database is ++my $tmp_dir = '/var/cache/queuegraph'; # temporary directory where to store the images + my $rrdtool_1_0 = ($RRDs::VERSION < 1.199908); + + my @graphs = ( +@@ -132,7 +132,6 @@ + $uri =~ s/\/[^\/]+$//; + $uri =~ s/\//,/g; + $uri =~ s/\~/tilde,/g; +- mkdir $tmp_dir, 0777 unless -d $tmp_dir; + mkdir "$tmp_dir/$uri", 0777 unless -d "$tmp_dir/$uri"; + my $file = "$tmp_dir/$uri$ENV{PATH_INFO}"; + if($ENV{PATH_INFO} =~ /^\/queuegraph_(\d+)\.png$/) { +--- queuegraph/queuegraph/queuegraph-rrd.sh.orig 2007-02-12 02:37:40.000000000 -0700 ++++ queuegraph/queuegraph/queuegraph-rrd.sh 2007-03-26 00:48:14.000000000 -0600 +@@ -36,7 +36,7 @@ + fi + + #set -x +-qdir=`postconf -h queue_directory` ++qdir=`/usr/sbin/postconf -h queue_directory` + active=`find $qdir/incoming $qdir/active $qdir/maildrop -type f -print | wc -l | awk '{print $1}'` + deferred=`find $qdir/deferred -type f -print | wc -l | awk '{print $1}'` + #printf "active: %d\ndeferred: %d\n" $active $deferred diff --git a/queuegraph.conf b/queuegraph.conf new file mode 100644 index 0000000..4c4c8bf --- /dev/null +++ b/queuegraph.conf @@ -0,0 +1,14 @@ +# +# Queuegraph: An postfix/sendmail queue analyzer +# +Alias /queuegraph /usr/share/queuegraph + + + AllowOverride None + Options +ExecCGI + DirectoryIndex queuegraph.cgi + + Order Deny,Allow + Deny from all + Allow from 127.0.0.1 + diff --git a/queuegraph.cron b/queuegraph.cron new file mode 100644 index 0000000..2e96c12 --- /dev/null +++ b/queuegraph.cron @@ -0,0 +1,4 @@ +# Runs the queuegraph update program +# +# This will run every one minute +* * * * * root /usr/sbin/queuegraph-rrd.sh &> /dev/null diff --git a/queuegraph.spec b/queuegraph.spec new file mode 100644 index 0000000..2d9aac8 --- /dev/null +++ b/queuegraph.spec @@ -0,0 +1,65 @@ +Name: queuegraph +Version: 1.1 +Release: 1%{?dist}%{?repotag:.%{repotag}} +Summary: A RRDtool frontend for Mail statistics + +Group: System Environment/Daemons +License: GPL + +URL: http://www.arschkrebs.de/postfix/queuegraph/ +Source0: http://www.arschkrebs.de/postfix/queuegraph/queuegraph.tar.gz +Source1: queuegraph.conf +Source2: queuegraph.cron +Patch0: queuegraph-paths.patch +Patch1: queuegraph-average.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +Requires: rrdtool, httpd, vixie-cron +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) + +BuildArch: noarch + +%description +Queuegraph is a very simple mail statistics RRDtool frontend for Postfix that +produces daily, weekly, monthly and yearly graphs of Postfix's active, +deferred, incoming and bounce queues. + + +%prep +%setup -q -c queuegraph +%patch0 -p1 -b .paths +%patch1 -p1 -b .average + +%build + +%install +rm -rf $RPM_BUILD_ROOT +%{__install} -d -m 0755 $RPM_BUILD_ROOT/%{_sbindir} +%{__install} -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d +%{__install} -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d +%{__install} -d -m 0755 $RPM_BUILD_ROOT/%{_datadir}/queuegraph +%{__install} -d -m 0755 $RPM_BUILD_ROOT/%{_localstatedir}/lib/queuegraph +%{__install} -d -m 0775 $RPM_BUILD_ROOT/%{_localstatedir}/cache/queuegraph + +%{__install} -p -m 0755 queuegraph.cgi $RPM_BUILD_ROOT/%{_datadir}/queuegraph/queuegraph.cgi +%{__install} -p -m 0755 queuegraph/queuegraph-rrd.sh $RPM_BUILD_ROOT/%{_sbindir}/ +%{__install} -p -m 0644 %SOURCE1 $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/ +%{__install} -p -m 0644 %SOURCE2 $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/queuegraph + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc queuegraph/README +%dir %{_localstatedir}/lib/queuegraph +%dir %attr(0775,root,apache) %{_localstatedir}/cache/queuegraph +%config(noreplace) %{_sysconfdir}/httpd/conf.d/queuegraph.conf +%config(noreplace) %{_sysconfdir}/cron.d/queuegraph +%{_sbindir}/* +%{_datadir}/queuegraph + + +%changelog +* Sun Mar 25 2007 Bernard Johnson - 1.1-1 +- initial release diff --git a/sources b/sources index e69de29..0a1f413 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +2e0c78563cef4fb3195b06e9ee102264 queuegraph.tar.gz