Package: pmacct
Version: 0.12.5-1
Even though the pmacct packages provides the sfacctd, nfacctd daemons in
addition
to the pmacctd daemon, they are missing corresponding initscripts, default-files
and sample configs.
I've attached proposed files for inclusion - the sfacct ones, I've tested, the
nfacct, pmacct ones, I've not. That said, the changes compared the currently
provided files for pmacct, is pretty much a matter of search/replace. The only
other changes I've made are:
- stop function of the initscripts now uses SIGTERM instead of SIGINT, as SIGINT
does not seem to be adequate anymore.
- the sample config files have had daemon-name_ prepended to the recovery_log
filenames.
I've tested the proposed changes on the sfacct side of things, on Ubuntu Lucid.
Please let me know if you'd rather have a diff or something.
/Thomas
# Defaults for nfacct initscript
# sourced by /etc/init.d/nfacct
# installed at /etc/default/sfacct by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Location of the configuration file
NFACCTD_CONF=/etc/pmacct/nfacctd.conf
# List of interfaces to start accounting on.
# See /usr/share/doc/pmacct/README.Debian for details.
INTERFACES=
# Additional options that are passed to nfacctd
DAEMON_OPTS=
#!/bin/sh
### BEGIN INIT INFO
# Provides: nfacct
# Required-start: $network $syslog
# Required-stop: $network $syslog
# Default-start: 2 3 4 5
# Default-stop: 0 1 6
# Short-Description: netflow accounting daemon
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/nfacctd
NAME=nfacctd
DESC=netflow accounting daemon
CONFDIR=/etc/pmacct
test -x $DAEMON || exit 0
# Include nfacct defaults if available
if [ -f /etc/default/nfacct ] ; then
. /etc/default/nfacct
fi
stop () {
#start-stop-daemon --stop --oknodo --quiet \
# --pidfile /var/run/$NAME.pid \
# --exec $DAEMON
killall -TERM nfacctd
}
start () {
#start-stop-daemon --start --oknodo --quiet \
# --pidfile /var/run/$NAME.pid \
# --exec $DAEMON -- -f $PMACCTD_CONF $DAEMON_OPTS
if [ -n $INTERFACES ]; then
for i in $INTERFACES; do
ip link set $i up
$DAEMON -f $CONFDIR/nfacctd.$i.conf $DAEMON_OPTS
done
else
$DAEMON -f $CONFDIR/nfacctd.conf $DAEMON_OPTS
fi
}
case $1 in
start)
echo -n Starting $DESC:
start
echo $NAME.
;;
stop)
echo -n Stopping $DESC:
stop
echo $NAME.
;;
#reload)
#
# If the daemon can reload its config files on the fly
# for example by sending it SIGHUP, do it here.
#
# If the daemon responds to changes in its config file
# directly anyway, make this a do-nothing entry.
#
# echo Reloading $DESC configuration files.
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
# /var/run/$NAME.pid --exec $DAEMON
#;;
restart|force-reload)
#
# If the reload option is implemented, move the force-reload
# option to the reload entry above. If not, force-reload is
# just the same as restart.
#
echo -n Restarting $DESC:
stop
sleep 1
start
echo $NAME.
;;
*)
N=/etc/init.d/$NAME
# echo Usage: $N {start|stop|restart|reload|force-reload} 2
echo Usage: $N {start|stop|restart|force-reload} 2
exit 1
;;
esac
exit 0
! nfacctd configuration
!
!
!
daemonize: true
pidfile: /var/run/nfacctd.pid
syslog: daemon
!
! interested in in and outbound traffic
aggregate: src_host,dst_host
! on this network
pcap_filter: net 127.0.0.0/8
! on this interface
interface: lo
!
! storage methods
!plugins: pgsql
!sql_host: localhost
!sql_passwd:
! refresh the db every minute
!sql_refresh_time: 60
! reduce the size of the insert/update clause
!sql_optimize_clauses: true
! accumulate values in each row for up to an hour
!sql_history: 1h
! create new rows on the minute, hour, day boundaries
!sql_history_roundoff: mhd
! in case of emergency, log to this file
!sql_recovery_logfile: /var/lib/pmacct/nfacctd_recovery_log
#!/bin/sh
### BEGIN INIT INFO
# Provides: pmacct
# Required-start: $network $syslog
# Required-stop: $network $syslog
# Default-start: 2 3 4 5
# Default-stop: 0 1 6
# Short-Description: promiscuous mode accounting daemon
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/pmacctd
NAME=pmacctd
DESC=promiscuous mode accounting daemon
CONFDIR=/etc/pmacct
test -x $DAEMON || exit 0
# Include pmacct defaults if available
if [ -f /etc/default/pmacct ] ; then
. /etc/default/pmacct
fi
stop () {
#start-stop-daemon --stop --oknodo --quiet \
# --pidfile /var/run/$NAME.pid \
# --exec $DAEMON
killall -TERM pmacctd
}
start () {
#start-stop-daemon --start --oknodo --quiet \
#