New port of a nifty utilty that uses perl to ping the networks you

specify, mysql to save the data, and php to display it. Fairly
configurable, and easy to set up.
This commit is contained in:
Doug Barton 2003-02-13 11:20:38 +00:00
parent 676a02a46a
commit 94c52d8c7f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=75447
9 changed files with 157 additions and 0 deletions

View file

@ -192,6 +192,7 @@
SUBDIR += gutenfetch
SUBDIR += h2n
SUBDIR += hagelslag
SUBDIR += hawk
SUBDIR += hesiod
SUBDIR += hlmaster
SUBDIR += honeyd

60
net/hawk/Makefile Normal file
View file

@ -0,0 +1,60 @@
# New ports collection makefile for: hawk
# Date created: 12 February 2003
# Whom: dougb
#
# $FreeBSD$
#
PORTNAME= hawk
PORTVERSION= 0.6
CATEGORIES= net
MASTER_SITES= http://umn.dl.sourceforge.net/sourceforge/iphawk/ \
http://unc.dl.sourceforge.net/sourceforge/iphawk/
MAINTAINER= DougB@FreeBSD.org
COMMENT= Track uptime and DNS status for machines on your networks
RUN_DEPENDS= php-config:${PORTSDIR}/www/mod_php4 \
safe_mysqld:${PORTSDIR}/databases/mysql323-server \
${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Net/Netmask.pm:${PORTSDIR}/net/p5-Net-Netmask
do-patch:
@${SED} -e 's#dirname.*"/hawk#"${PREFIX}/etc/hawk/daemon#' \
${WRKSRC}/daemon/hawk > ${WRKSRC}/daemon/hawk.sed
@${MV} ${WRKSRC}/daemon/hawk.sed ${WRKSRC}/daemon/hawk
@${SED} -e 's#hawk.conf#daemon.conf#' \
${WRKSRC}/php/hawk.conf.inc > ${WRKSRC}/php/hawk.conf.inc.sed
@${MV} ${WRKSRC}/php/hawk.conf.inc.sed ${WRKSRC}/php/hawk.conf.inc
@${SED} -e 's#hawk.conf.inc#${PREFIX}/etc/hawk/php.conf#' \
${WRKSRC}/php/hawk.php > ${WRKSRC}/php/hawk.php.sed
@${MV} ${WRKSRC}/php/hawk.php.sed ${WRKSRC}/php/hawk.php
do-build:
# Empty target, nothing to build
do-install:
${MKDIR} ${PREFIX}/etc/hawk
${INSTALL_DATA} ${WRKSRC}/daemon/hawk.conf ${PREFIX}/etc/hawk/daemon.conf.sample
${INSTALL_SCRIPT} ${WRKSRC}/daemon/hawk ${PREFIX}/sbin
${MKDIR} ${PREFIX}/www/data-dist/hawk/images
(for file in ${WRKSRC}/php/images/*; do \
${INSTALL_DATA} $$file ${PREFIX}/www/data-dist/hawk/images; \
done)
${INSTALL_DATA} ${WRKSRC}/php/hawk.php ${PREFIX}/www/data-dist/hawk
${INSTALL_DATA} ${WRKSRC}/php/hawk.css ${PREFIX}/www/data-dist/hawk
${INSTALL_DATA} ${WRKSRC}/php/hawk.conf.inc \
${PREFIX}/etc/hawk/php.conf.sample
${SED} -e 's#%%PREFIX%%#${PREFIX}#' ${FILESDIR}/hawk.sh > \
${WRKDIR}/hawk.sh.sample
${INSTALL_SCRIPT} ${WRKDIR}/hawk.sh.sample ${PREFIX}/etc/rc.d
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
${INSTALL_DATA} ${FILESDIR}/create_hawk_db.sql ${DOCSDIR}
${INSTALL_DATA} ${FILESDIR}/create_hawk_user.sql ${DOCSDIR}
.endif
post-install:
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>

1
net/hawk/distinfo Normal file
View file

@ -0,0 +1 @@
MD5 (hawk-0.6.tar.gz) = 0126343848ebed9a5d62292e3fd603a1

View file

@ -0,0 +1,13 @@
# Feed this file to mysql, e.g.,
# mysql -v < create_hawk_db.sql
create database hawk;
use hawk;
create table ip (
ip char(16) NOT NULL default '0',
hostname char(255) default NULL,
lastping int(10) default NULL,
primary key (ip),
unique key ip (ip),
key ip_2 (ip)
) type=MyISAM comment='Table for last ping time of hosts';

View file

@ -0,0 +1,8 @@
# Feed this file to mysql, e.g.,
# mysql -v < create_hawk_user.sql
grant select,insert,update,delete
on hawk.*
to hawk@localhost
identified by 'YOUR_PASSWORD_HERE';
flush privileges;

34
net/hawk/files/hawk.sh Normal file
View file

@ -0,0 +1,34 @@
#!/bin/sh
PATH=/bin:/usr/bin
export PATH
stop_hawk () {
if [ -f /var/run/hawk.pid ];then
kill `cat /var/run/hawk.pid`
else
ps -ax | awk '/[h]awk$/ {print $1}' | xargs kill
fi
}
case "${1}" in
start)
echo 'Starting hawk'
%%PREFIX%%/sbin/hawk &
;;
stop)
echo 'Stopping hawk'
stop_hawk
;;
restart)
echo 'Restarting hawk'
stop_hawk
%%PREFIX%%/sbin/hawk &
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0

16
net/hawk/pkg-descr Normal file
View file

@ -0,0 +1,16 @@
Hawk is a web based utility for monitoring and comparing hosts
on your network with what's in DNS. Hosts that are answering
pings but are not in dns may be unauthorized, and hosts that are
in DNS, but are not answering may be able to be reclaimed. Hawk
monitors all hosts on the networks you specify and lets you view
them via a web page.
Hawk consists of a backend written in perl that monitors hosts by
icmp pings and writes the status to a mysql database. The frontend
is in php and lets you select which network to view, and how to view
it.
WWW: http://sourceforge.net/projects/iphawk/
- Doug Barton
DougB@FreeBSD.org

4
net/hawk/pkg-message Normal file
View file

@ -0,0 +1,4 @@
See PREFIX/share/doc/hawk/create_hawk* for instructions on creating
the database and user that the php code expects.

20
net/hawk/pkg-plist Normal file
View file

@ -0,0 +1,20 @@
etc/hawk/daemon.conf.sample
etc/hawk/php.conf.sample
etc/rc.d/hawk.sh.sample
sbin/hawk
www/data-dist/hawk/images/bluesphere.png
www/data-dist/hawk/images/greensphere.png
www/data-dist/hawk/images/hawk.jpg
www/data-dist/hawk/images/purplesphere.png
www/data-dist/hawk/images/questionsphere.png
www/data-dist/hawk/images/redsphere.png
www/data-dist/hawk/images/yellowsphere.png
www/data-dist/hawk/hawk.php
www/data-dist/hawk/hawk.css
%%PORTDOCS%%share/doc/hawk/README
%%PORTDOCS%%share/doc/hawk/create_hawk_db.sql
%%PORTDOCS%%share/doc/hawk/create_hawk_user.sql
%%PORTDOCS%%@dirrm share/doc/hawk
@unexec rmdir %D/etc/hawk 2>/dev/null || true
@dirrm www/data-dist/hawk/images
@dirrm www/data-dist/hawk