summaryrefslogtreecommitdiff
path: root/network
diff options
context:
space:
mode:
Diffstat (limited to 'network')
-rw-r--r--network/ntop/README57
-rw-r--r--network/ntop/doinst.sh21
-rw-r--r--network/ntop/ntop.SlackBuild127
-rw-r--r--network/ntop/ntop.info8
-rw-r--r--network/ntop/ntop.logrotate11
-rw-r--r--network/ntop/rc.ntop95
-rw-r--r--network/ntop/slack-desc19
7 files changed, 338 insertions, 0 deletions
diff --git a/network/ntop/README b/network/ntop/README
new file mode 100644
index 0000000000..758c4fdd44
--- /dev/null
+++ b/network/ntop/README
@@ -0,0 +1,57 @@
+ntop is a network probe that shows network usage in a way similar to
+what top does for processes. In interactive mode, it displays the
+network status on the user's terminal. In Web mode, it acts as a Web
+server, creating an HTML dump of the network status.
+
+It sports a NetFlow/sFlow emitter/collector, an HTTP-based client
+interface for creating ntop-centric monitoring applications, and
+RRD for persistently storing traffic statistics.
+
+ntop requires rrdtool, which is also available at Slackbuilds.org.
+
+ntop needs to run under its own user/group. This has been assigned to
+the following by SlackBuilds.org, but feel free to change it on your
+system for consistency with local assignments.
+ User: ntop UID: 212 GID: 212
+ group: ntop GID: 212
+
+If you want to change that, you'll need to change the script and
+the rc.ntop to reflect your changes.
+
+Logs are placed in /var/log/ntop/ and will be rotated every week. The
+log rotation will restart the ntop server which will reset the ntop
+statistics. If you want to keep the statistics you have to edit or delete
+the /etc/logrotate.d/ntop file.
+
+If you want to start ntop on system bootup:
+
+/etc/rc.d/rc.local
+==================
+ # Startup ntop
+ if [ -x /etc/rc.d/rc.ntop ]; then
+ /etc/rc.d/rc.ntop start
+ fi
+
+/etc/rc.d/rc.local_shutdown
+===========================
+ # Stop ntop
+ if [ -x /etc/rc.d/rc.ntop ]; then
+ /etc/rc.d/rc.ntop stop
+ fi
+
+Additionally, you'll have to set the rc script to be executable just
+like any other Slackware rc script.
+ # chmod +x /etc/rc.d/rc.ntop
+
+When ntop is installed at the first time, you MUST set the
+administration password for ntop (user 'admin'). You do that
+by running ntop with the option -A (or --set-admin-password) as root.
+ # /usr/bin/ntop -P <ntop_homedirectory> -u <ntopuser> -A
+ For example:
+ # /usr/bin/ntop -P /var/lib/ntop -u ntop -A
+It will prompt you for the password and then exit.
+
+Running ntop:
+Once ntop has started and configured correctly, you should be able to look
+at all the data it's collected by pointing your browser at:
+ http://localhost:3000/
diff --git a/network/ntop/doinst.sh b/network/ntop/doinst.sh
new file mode 100644
index 0000000000..d7977216d6
--- /dev/null
+++ b/network/ntop/doinst.sh
@@ -0,0 +1,21 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+# Keep same perms on rc.ntop.new:
+if [ -e etc/rc.d/rc.ntop ]; then
+ cp -a etc/rc.d/rc.ntop etc/rc.d/rc.ntop.new.incoming
+ cat etc/rc.d/rc.ntop.new > etc/rc.d/rc.ntop.new.incoming
+ mv etc/rc.d/rc.ntop.new.incoming etc/rc.d/rc.ntop.new
+fi
+
+config etc/rc.d/rc.ntop.new
+config etc/logrotate.d/ntop.new
diff --git a/network/ntop/ntop.SlackBuild b/network/ntop/ntop.SlackBuild
new file mode 100644
index 0000000000..8c8262a726
--- /dev/null
+++ b/network/ntop/ntop.SlackBuild
@@ -0,0 +1,127 @@
+#!/bin/sh
+
+# Slackware build script for ntop
+# Written by (Michiel van Wessem (michiel@slackbuilds.org)
+
+# Copyright 2007 Michiel van Wessem (http://michielvwessem.wordpress.com)
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+set -e
+
+PRGNAM=ntop
+VERSION=3.3
+ARCH=${ARCH:-i486}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+DOCFILES="AUTHORS CONTENTS COPYING ChangeLog INSTALL MANIFESTO NEWS PORTING \
+ README SUPPORT_NTOP.txt THANKS ntop.html ntop.txt docs/* NetFlow www"
+
+# Bail out if user or group isn't valid on your system
+# For slackbuilds.org, assigned ntop uid/gid are 212/212
+# see http://slackbuilds.org/uid_gid.txt
+if ! grep ^ntop: /etc/group 2>&1 > /dev/null; then
+ echo " Must have a ntop group to run this script."
+ echo " # groupadd -g 212 ntop"
+ echo " Or something similar."
+ exit 1
+elif ! grep ^ntop: /etc/passwd 2>&1 > /dev/null; then
+ echo " Must have a ntop user to run this script."
+ echo " # useradd -u 212 -g ntop -d /var/lib/ntop -s /bin/false ntop"
+ echo " Or something similar."
+ exit 1
+fi
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+chmod -R u+w,go+r-w,a-s .
+
+# Since ntop calls their ./configure from autogen.sh anything passed onto
+# autogen.sh (ie $@) is passed off as command line arguments to configure.
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./autogen.sh \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var/lib \
+ --mandir=/usr/man \
+ --with-tcpwrap \
+ --enable-sslv3 \
+ --enable-sslwatchdog \
+ --enable-snmp \
+ --enable-i18n \
+ --program-prefix="" \
+ --program-suffix=""
+
+make
+make install DESTDIR=$PKG
+
+( cd $PKG
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+)
+
+( cd $PKG/usr/man
+ find . -type f -exec gzip -9 {} \;
+ for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
+)
+
+# Bug in ntop source:: http://tinyurl.com/2wf7ou . This should at somepoint
+# be dealt with upstream. For now fix this in $PKG :)
+if [ -d $PKG/usr/lib/plugins ]; then
+ rmdir -v $PKG/usr/lib/plugins
+fi
+
+# Copy *all* documentation over (docs/ is not included in make install for
+# some arkane reason. Rename some docs to prevent them copying over each other.
+for FILE in {README,INSTALL}; do mv docs/$FILE docs/$FILE.docs ; done
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a $DOCFILES $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
+
+mkdir -p $PKG/etc/logrotate.d $PKG/etc/rc.d
+install -m 0644 $CWD/$PRGNAM.logrotate $PKG/etc/logrotate.d/$PRGNAM.new
+install -m 0755 $CWD/rc.$PRGNAM $PKG/etc/rc.d/rc.$PRGNAM.new
+
+# Change the permissions on ntops homedir so we can write logs
+chown -R ntop:ntop $PKG/var/lib/$PRGNAM/
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
diff --git a/network/ntop/ntop.info b/network/ntop/ntop.info
new file mode 100644
index 0000000000..7f0dfeb440
--- /dev/null
+++ b/network/ntop/ntop.info
@@ -0,0 +1,8 @@
+PRGNAM="ntop"
+VERSION="3.3"
+HOMEPAGE="http://www.ntop.org"
+DOWNLOAD="http://downloads.sourceforge.net/ntop/ntop-3.3.tar.gz"
+MD5SUM="a0e52a85587c8a5519d822d04862dab4 "
+MAINTAINER="Michiel van Wessem"
+EMAIL="michiel@slackbuilds.org"
+APPROVED="rworkman"
diff --git a/network/ntop/ntop.logrotate b/network/ntop/ntop.logrotate
new file mode 100644
index 0000000000..a387c5018f
--- /dev/null
+++ b/network/ntop/ntop.logrotate
@@ -0,0 +1,11 @@
+/var/log/ntop {
+ # based on ntop.logrotate included in the ntop/debian source.
+ weekly
+ missingok
+ rotate 4
+ # ntop doesn't handle SIGHUP
+ copytruncate
+ nocompress
+ notifempty
+ create 640 root wheel
+}
diff --git a/network/ntop/rc.ntop b/network/ntop/rc.ntop
new file mode 100644
index 0000000000..0d468cf799
--- /dev/null
+++ b/network/ntop/rc.ntop
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+# /etc/rc.d/rc.ntop : start/stop/restart ntop
+# usage: ./rc.ntop { start | stop | restart }
+
+# Thanks to andarius <andarius@errantnutron.com> for donating
+# time and the various cleanups in the script and the start|stop|restart
+# functions.
+
+NTOPUID=ntop
+NTOPGID=ntop
+NTOPLOG=/var/log/ntop
+DATE=$(date +%a\ %b\ %d\ %T\ %Y)
+RETVAL=0
+
+# Sanity Checking
+if [ ! -r "/var/lib/ntop/ntop_pw.db" ]; then
+ echo "Can not read ntop password database. Exiting..."
+ exit 1
+fi
+
+ntop_start() {
+ echo -n $"Starting ntop ... "
+ if [ -r /var/run/ntop.pid ]; then
+ if $(! /sbin/pidof ntop > /dev/null 2>&1 ) ; then
+ echo "Removing an old /var/run/ntop.pid"
+ rm -f /var/run/ntop.pid
+ fi
+ fi
+ /usr/bin/ntop --w3c -u $NTOPUID -d >> $NTOPLOG 2>&1
+ RETVAL=$?
+
+ if [ $RETVAL -eq 0 ]; then
+ touch /var/lock/subsys/ntop
+ sleep 2
+ echo "Done"
+ else
+ echo "Failed"
+ fi
+ return $RETVAL
+}
+
+ntop_stop() {
+ echo -n $"Stopping ntop ... "
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ if [ -r /var/run/ntop.pid ]; then
+ killall ntop
+ # Give it some time to die gracefully
+ for second in 0 1 2 3 4 5 6 7 8 9 10 ; do
+ if $(! /sbin/pidof ntop > /dev/null 2>&1 ) ; then
+ # ntop is a dirty little deamon:
+ rm -f /var/run/ntop.pid
+ break;
+ fi
+ sleep 1
+ done
+
+ if [ "$second" = "10" ]; then
+ echo "\nWARNING: ntop did not exit!"
+ sleep 10
+ else
+ # Yes there are two spaces as this is the way ntop writes
+ # their logfiles.
+ echo "$DATE EXIT: ntop stopped by user: $USER (UID: $EUID)" >> $NTOPLOG
+ echo "Done"
+ fi
+ fi
+ rm -f /var/lock/subsys/ntop
+ fi
+ return $RETVAL
+}
+
+# Lets see how we are being called:
+case "$1" in
+ start)
+ ntop_start
+ ;;
+ stop)
+ ntop_stop
+ ;;
+ restart|reload)
+ ntop_stop
+ # Takes a few to recover and be able to start again:
+ sleep 10
+ ntop_start
+ ;;
+ *)
+ echo ""
+ echo "Usage: $(basename $0) {start | stop | restart }"
+ RETVAL=1
+esac
+
+exit $RETVAL
+#EOF
diff --git a/network/ntop/slack-desc b/network/ntop/slack-desc
new file mode 100644
index 0000000000..d73cd0030b
--- /dev/null
+++ b/network/ntop/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+ntop: ntop (Network usage with shiny graphs)
+ntop:
+ntop: ntop is a network probe that shows network usage in a way similar to
+ntop: what top does for processes. In interactive mode, it displays the
+ntop: network status on the user's terminal. In Web mode, it acts as a Web
+ntop: server, creating an HTML dump of the network status.
+ntop:
+ntop: It sports a NetFlow/sFlow emitter/collector, an HTTP-based client
+ntop: interface for creating ntop-centric monitoring applications, and
+ntop: RRD for persistently storing traffic statistics.
+ntop: