[Midnightbsd-cvs] mports: mports/dns: Add bindgraph, a tool to monitor bind query stats.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 7 12:35:55 EDT 2008


Log Message:
-----------
Add bindgraph, a tool to monitor bind query stats.

Modified Files:
--------------
    mports/dns:
        Makefile (r1.13 -> r1.14)

Added Files:
-----------
    mports/dns/bindgraph:
        Makefile (r1.1)
        distinfo (r1.1)
        pkg-descr (r1.1)
        pkg-message (r1.1)
        pkg-plist (r1.1)
    mports/dns/bindgraph/files:
        bindgraph.in (r1.1)
        patch-bindgraph.cgi (r1.1)

-------------- next part --------------
--- /dev/null
+++ 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.
--- /dev/null
+++ 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/
--- /dev/null
+++ dns/bindgraph/pkg-plist
@@ -0,0 +1,3 @@
+%%CGIDIR%%/bindgraph.cgi
+sbin/bindgraph.pl
+ at dirrmtry %%CGIDIR%%
--- /dev/null
+++ dns/bindgraph/Makefile
@@ -0,0 +1,65 @@
+# New ports collection makefile for:	bindgraph
+# Date created:				Nov 29 2007
+# Whom:					Rong-En Fan <rafan at FreeBSD.org>
+#
+# $MidnightBSD: mports/dns/bindgraph/Makefile,v 1.1 2008/06/07 16:35:53 laffer1 Exp $
+# $FreeBSD: ports/dns/bindgraph/Makefile,v 1.2 2008/03/30 12:06:56 rafan Exp $
+#
+
+PORTNAME=	bindgraph
+PORTVERSION=	0.2
+PORTREVISION=	0
+CATEGORIES=	dns
+MASTER_SITES=	http://www.linux.it/~md/software/
+EXTRACT_SUFX=	.tgz
+
+MAINTAINER=	ports at MidnightBSD.org
+COMMENT=	A RRDtool frontend for BIND statistics
+LICENSE=	gpl2
+
+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
+
+.include <bsd.port.mk>
--- /dev/null
+++ 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
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/dns/Makefile,v
retrieving revision 1.13
retrieving revision 1.14
diff -L dns/Makefile -L dns/Makefile -u -r1.13 -r1.14
--- dns/Makefile
+++ dns/Makefile
@@ -7,6 +7,7 @@
     SUBDIR += bind9
     SUBDIR += bind94
     SUBDIR += bind95
+    SUBDIR += bindgraph
     SUBDIR += c-ares
     SUBDIR += ddclient
     SUBDIR += ez-ipupdate
--- /dev/null
+++ dns/bindgraph/files/bindgraph.in
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# $MidnightBSD: mports/dns/bindgraph/files/bindgraph.in,v 1.1 2008/06/07 16:35:53 laffer1 Exp $
+# $FreeBSD: ports/dns/bindgraph/files/bindgraph.in,v 1.1 2007/12/13 06:55:32 rafan Exp $
+#
+# 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"
--- /dev/null
+++ dns/bindgraph/files/patch-bindgraph.cgi
@@ -0,0 +1,48 @@
+--- bindgraph.cgi.orig	2003-05-05 06:26:18.000000000 +0800
++++ bindgraph.cgi	2008-03-30 18:04:38.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 = '%%DATADIR%%/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;
+@@ -209,6 +213,7 @@
+ 	$uri =~ s#/#,#g;
+ 	$uri =~ s#~#tilde,#g;
+ 
++	mkdir("$tmp_dir", 0755);
+ 	die_fatal("ERROR: $tmp_dir does not exist") if not -d $tmp_dir;
+ 
+ 	if (not -d "$tmp_dir/$uri") {


More information about the Midnightbsd-cvs mailing list