summaryrefslogtreecommitdiff
path: root/dns
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2007-12-13 06:55:32 +0000
committerRong-En Fan <rafan@FreeBSD.org>2007-12-13 06:55:32 +0000
commit8f2be0234bd4ec496288ec766416aab659734d75 (patch)
tree0a05831d3d8675a02f4e76e31d64b2ae0d7eba26 /dns
parent- Update to 0.9.4 (diff)
Bindgraph makes pretty query statistics about BIND servers. It was derived
from well-known mailgraph package. WWW: http://www.linux.it/~md/software/
Notes
Notes: svn path=/head/; revision=203448
Diffstat (limited to 'dns')
-rw-r--r--dns/Makefile1
-rw-r--r--dns/bindgraph/Makefile67
-rw-r--r--dns/bindgraph/distinfo3
-rw-r--r--dns/bindgraph/files/bindgraph.in38
-rw-r--r--dns/bindgraph/files/patch-bindgraph.cgi40
-rw-r--r--dns/bindgraph/pkg-descr4
-rw-r--r--dns/bindgraph/pkg-message12
-rw-r--r--dns/bindgraph/pkg-plist3
8 files changed, 168 insertions, 0 deletions
diff --git a/dns/Makefile b/dns/Makefile
index 03e576f4c64b..0dc95d978d65 100644
--- a/dns/Makefile
+++ b/dns/Makefile
@@ -9,6 +9,7 @@
SUBDIR += bind9-dlz
SUBDIR += bind9-sdb-ldap
SUBDIR += bind94
+ SUBDIR += bindgraph
SUBDIR += c-ares
SUBDIR += checkdns
SUBDIR += crossip
diff --git a/dns/bindgraph/Makefile b/dns/bindgraph/Makefile
new file mode 100644
index 000000000000..9f049f59cec5
--- /dev/null
+++ b/dns/bindgraph/Makefile
@@ -0,0 +1,67 @@
+# New ports collection makefile for: bindgraph
+# Date created: Nov 29 2007
+# Whom: Rong-En Fan <rafan@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= bindgraph
+PORTVERSION= 0.2
+CATEGORIES= dns
+MASTER_SITES= http://www.linux.it/~md/software/
+EXTRACT_SUFX= .tgz
+
+MAINTAINER= rafan@FreeBSD.org
+COMMENT= A RRDtool frontend for BIND statistics
+
+RUN_DEPENDS= ${SITE_PERL}/RRDp.pm:${PORTSDIR}/databases/rrdtool \
+ ${SITE_PERL}/File/Tail.pm:${PORTSDIR}/devel/p5-File-Tail
+
+NO_BUILD= yes
+USE_PERL5= yes
+
+CGIDIR?= ${PREFIX}/www/cgi-bin
+DATADIR?= /var/db/bindgraph
+BINDGRAPH_USER?= ${WWWOWN}
+BINDGRAPH_GROUP?= ${WWWGRP}
+
+USE_RC_SUBR= ${PORTNAME}
+SUB_LIST+= BINDGRAPH_USER=${BINDGRAPH_USER} BINDGRAPH_GROUP=${BINDGRAPH_GROUP}
+PLIST_SUB= CGIDIR=${CGIDIR:S,${PREFIX}/,,}
+
+DOCS= README ChangeLog
+.if !defined(NOPORTDOCS)
+PORTDOCS= ${DOCS}
+.endif
+
+pre-everything::
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "You may set following options:"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "DATADIR=/var/db/bindgraph Where do you put RRD databases?"
+ @${ECHO_MSG} "CGIDIR=${PREFIX}/www/cgi-bin Where do you put cgi?"
+ @${ECHO_MSG} "BINDGRAPH_USER=www User to run bindgraph (Default: ${WWWOWN})"
+ @${ECHO_MSG} ""
+
+post-patch:
+ @${REINPLACE_CMD} -e "s,%%DATADIR%%,${DATADIR}," ${WRKSRC}/bindgraph.cgi
+
+do-install:
+ ${MKDIR} ${CGIDIR}
+ ${MKDIR} ${DATADIR}
+ @${CHOWN} -R ${BINDGRAPH_USER}:${BINDGRAPH_GROUP} ${DATADIR}
+ @${INSTALL_SCRIPT} ${WRKSRC}/bindgraph.pl ${PREFIX}/sbin
+ @${INSTALL_SCRIPT} ${WRKSRC}/bindgraph.cgi ${CGIDIR}
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${DOCSDIR}
+ for f in ${DOCS}; do \
+ ${INSTALL_DATA} ${WRKSRC}/$$f ${DOCSDIR}; \
+ done
+.endif
+
+post-install:
+ @${ECHO_MSG} ""
+ @${CAT} ${PKGMESSAGE}
+ @${ECHO_MSG} ""
+
+.include <bsd.port.mk>
diff --git a/dns/bindgraph/distinfo b/dns/bindgraph/distinfo
new file mode 100644
index 000000000000..12d54dfd5151
--- /dev/null
+++ b/dns/bindgraph/distinfo
@@ -0,0 +1,3 @@
+MD5 (bindgraph-0.2.tgz) = e220b09d3313691444d2f1a2f452ec10
+SHA256 (bindgraph-0.2.tgz) = 680ca9a73a9c06e3c4281f52eb7af95871d69f909642ca490d2da437c522bff6
+SIZE (bindgraph-0.2.tgz) = 15808
diff --git a/dns/bindgraph/files/bindgraph.in b/dns/bindgraph/files/bindgraph.in
new file mode 100644
index 000000000000..30fa1f47f66a
--- /dev/null
+++ b/dns/bindgraph/files/bindgraph.in
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: bindgraph
+# REQUIRE: DAEMON
+#
+# Add the following line to /etc/rc.conf to enable bindgraph:
+#
+# bindgraph_enable="YES"
+#
+
+. %%RC_SUBR%%
+
+name="bindgraph"
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/${name}.pl > /dev/null 2>&1
+command_interpreter=/usr/bin/perl
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+ rm -f $pidfile
+}
+
+load_rc_config $name
+load_rc_config_var named chrootdir
+
+: ${bindgraph_enable="NO"}
+: ${bindgraph_pidfile="%%DATADIR%%/bindgraph.pid"}
+: ${bindgraph_flags="--logfile ${named_chrootdir}/var/log/query.log --daemon_rrd=%%DATADIR%% --daemon --daemon_pid=${bindgraph_pidfile}"}
+: ${bindgraph_user="%%BINDGRAPH_USER%%"}
+: ${bindgraph_chdir="%%DATADIR%%"}
+
+pidfile=${bindgraph_pidfile}
+
+run_rc_command "$1"
diff --git a/dns/bindgraph/files/patch-bindgraph.cgi b/dns/bindgraph/files/patch-bindgraph.cgi
new file mode 100644
index 000000000000..cebfa9e0a2f7
--- /dev/null
+++ b/dns/bindgraph/files/patch-bindgraph.cgi
@@ -0,0 +1,40 @@
+--- bindgraph.cgi.orig 2003-05-05 06:26:18.000000000 +0800
++++ bindgraph.cgi 2007-11-30 22:08:18.000000000 +0800
+@@ -8,13 +8,14 @@
+
+ use RRDs;
+ use strict;
++use POSIX qw(uname);
+
+ my $VERSION = '0.1';
+
+ # hostname. will be printed in the HTML page
+-my $hostname = 'hostname.example.net (please edit bindgraph.cgi)';
++my $hostname = (POSIX::uname())[1];
+ # path of the RRD database
+-my $rrd = '/var/www/as112/rrd/bindgraph.rrd';
++my $rrd = '/var/db/bindgraph/bindgraph.rrd';
+ # temporary directory where the images will be saved
+ my $tmp_dir = '/tmp/bindgraph';
+
+@@ -89,6 +90,10 @@
+ }
+ }
+
++ my $comment = 'last update: ' . localtime(last_update($rrd))
++ . ' graph created on ' . localtime(time) . '\r';
++ $comment =~ s|:|\\:|g unless $RRDs::VERSION < 1.199908;
++
+ my ($text, $xs, $ys) = RRDs::graph(
+ $file,
+ '--imgformat', 'PNG',
+@@ -102,8 +107,7 @@
+ @rrdef,
+ @rrprint,
+ 'COMMENT:\s',
+- 'COMMENT:last update: ' . localtime(last_update($rrd))
+- . ' graph created on ' . localtime(time) . '\r',
++ 'COMMENT:' . $comment,
+ );
+ my $err = RRDs::error;
+ die_fatal("RRDs::graph($file, ...): $err") if $err;
diff --git a/dns/bindgraph/pkg-descr b/dns/bindgraph/pkg-descr
new file mode 100644
index 000000000000..f0da4b49cc0d
--- /dev/null
+++ b/dns/bindgraph/pkg-descr
@@ -0,0 +1,4 @@
+Bindgraph makes pretty query statistics about BIND servers. It was derived
+from well-known mailgraph package.
+
+WWW: http://www.linux.it/~md/software/
diff --git a/dns/bindgraph/pkg-message b/dns/bindgraph/pkg-message
new file mode 100644
index 000000000000..34faeed075ae
--- /dev/null
+++ b/dns/bindgraph/pkg-message
@@ -0,0 +1,12 @@
+To get bindgraph working, you have to set querylog for bind. An example
+named.conf will be
+
+ logging {
+ channel "querylog" {
+ file "/var/log/query.log" versions 50 size 20m;
+ print-time yes;
+ };
+ category queries { querylog; };
+ };
+
+Make sure BINDGRAPH_USER (default www) can read this log file.
diff --git a/dns/bindgraph/pkg-plist b/dns/bindgraph/pkg-plist
new file mode 100644
index 000000000000..496965b62860
--- /dev/null
+++ b/dns/bindgraph/pkg-plist
@@ -0,0 +1,3 @@
+%%CGIDIR%%/bindgraph.cgi
+sbin/bindgraph.pl
+@dirrmtry %%CGIDIR%%