1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00

Bindgraph makes pretty query statistics about BIND servers. It was derived

from well-known mailgraph package.

WWW: http://www.linux.it/~md/software/
This commit is contained in:
Rong-En Fan 2007-12-13 06:55:32 +00:00
parent 8862c70d1f
commit 8f2be0234b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=203448
8 changed files with 168 additions and 0 deletions

View File

@ -9,6 +9,7 @@
SUBDIR += bind9-dlz
SUBDIR += bind9-sdb-ldap
SUBDIR += bind94
SUBDIR += bindgraph
SUBDIR += c-ares
SUBDIR += checkdns
SUBDIR += crossip

67
dns/bindgraph/Makefile Normal file
View File

@ -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>

3
dns/bindgraph/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (bindgraph-0.2.tgz) = e220b09d3313691444d2f1a2f452ec10
SHA256 (bindgraph-0.2.tgz) = 680ca9a73a9c06e3c4281f52eb7af95871d69f909642ca490d2da437c522bff6
SIZE (bindgraph-0.2.tgz) = 15808

View File

@ -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"

View File

@ -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;

4
dns/bindgraph/pkg-descr Normal file
View File

@ -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/

12
dns/bindgraph/pkg-message Normal file
View File

@ -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.

3
dns/bindgraph/pkg-plist Normal file
View File

@ -0,0 +1,3 @@
%%CGIDIR%%/bindgraph.cgi
sbin/bindgraph.pl
@dirrmtry %%CGIDIR%%