aboutsummaryrefslogtreecommitdiffstats
path: root/main/nfdump
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2015-12-10 10:40:01 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2015-12-10 10:43:42 +0000
commite490ba69b1f34788f3da6e2ed2cfcddb787861f7 (patch)
treeb38b3ec173d8785458b59e42b1cf67f2797d25be /main/nfdump
parent6dc6352315dab985e4f651ddae90e7db19b247f8 (diff)
downloadaports-e490ba69b1f34788f3da6e2ed2cfcddb787861f7.tar.bz2
aports-e490ba69b1f34788f3da6e2ed2cfcddb787861f7.tar.xz
main/nfdump: enable sflow collector
Diffstat (limited to 'main/nfdump')
-rw-r--r--main/nfdump/APKBUILD34
-rw-r--r--main/nfdump/sfcapd.confd64
-rw-r--r--main/nfdump/sfcapd.initd50
3 files changed, 142 insertions, 6 deletions
diff --git a/main/nfdump/APKBUILD b/main/nfdump/APKBUILD
index 0e7ba45505..5de2fc1ece 100644
--- a/main/nfdump/APKBUILD
+++ b/main/nfdump/APKBUILD
@@ -1,7 +1,8 @@
+# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=nfdump
pkgver=1.6.13
-pkgrel=0
+pkgrel=1
pkgdesc="The nfdump tools collect and process netflow data on the command line."
url="http://nfdump.sourceforge.net/"
arch="all"
@@ -10,11 +11,14 @@ depends=""
depends_dev=""
makedepends="bison flex $depends_dev rrdtool-dev"
install=""
-subpackages="$pkgname-doc $pkgname-dbg nfprofile"
+subpackages="$pkgname-doc $pkgname-dbg nfprofile sfcapd"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
fix-64bit-fts-compat.patch
nfcapd.confd
- nfcapd.initd"
+ nfcapd.initd
+ sfcapd.confd
+ sfcapd.initd
+ "
_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
@@ -34,6 +38,7 @@ build() {
--host=$CHOST \
--prefix=/usr \
--enable-nfprofile \
+ --enable-sflow \
|| return 1
make || return 1
}
@@ -56,15 +61,32 @@ nfprofile() {
mv "$pkgdir"/usr/bin/nfprofile "$subpkgdir"/usr/bin || return 1
}
+sfcapd() {
+ pkgdesc="sFlow collector"
+ cd "$_builddir"
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/sfcapd "$subpkgdir"/usr/bin || return 1
+ install -D -m644 "$srcdir"/sfcapd.confd \
+ "$subpkgdir"/etc/conf.d/sfcapd
+ install -D -m755 "$srcdir"/sfcapd.initd \
+ "$subpkgdir"/etc/init.d/sfcapd
+}
+
md5sums="f5e916049aec1b531c63303b92270d42 nfdump-1.6.13.tar.gz
e7f9467142159da5ebbb4aa858aae142 fix-64bit-fts-compat.patch
541c45b9ac0e85ac955dd58919972b18 nfcapd.confd
-a82001153dbdfa6c4125064fcc7cd090 nfcapd.initd"
+a82001153dbdfa6c4125064fcc7cd090 nfcapd.initd
+443ef11c9b458c12d0efea627742732c sfcapd.confd
+1ac7c20be80b87fc725310747125e081 sfcapd.initd"
sha256sums="251533c316c9fe595312f477cdb051e9c667517f49fb7ac5b432495730e45693 nfdump-1.6.13.tar.gz
8ffd9160bb5cb639cec08ac68be5cbd33ef918e41630d02c18a75e03881cb5a9 fix-64bit-fts-compat.patch
7cb26698b26f5cd6c9c6cb2b49bb7be3cc0faffe851c5ac5c78e0a41984a276f nfcapd.confd
-33c3b5c42655410661f1019e3b8bccb8b875400861a945a7dd784f80520f8a97 nfcapd.initd"
+33c3b5c42655410661f1019e3b8bccb8b875400861a945a7dd784f80520f8a97 nfcapd.initd
+4559669b23534a7bec9cc9d342e7abd55316393ccb4dc57e9b335ac27bdf920c sfcapd.confd
+4fd63dee5323ce4116fffffa7573bb6a0f781d36867204e7d3670c182a078c56 sfcapd.initd"
sha512sums="92c21462cddc69b3551d0ed5c20c7b87e5b4e6438efcbc16aac0e8af45b8ec7e5a361c6e514effcf78c1e78fd892959e8f39bb08915d4daedf4b6e932303688d nfdump-1.6.13.tar.gz
71a838d493658a3a8479bc9eca70a857fd8629937d4954d21c1d5453d6cc122c089f72e3e109425c902439ee8cfaa273b4089ac347d1fe926473ce6062b7c49a fix-64bit-fts-compat.patch
fcb467f819f2b73ac0e13de6de4d6c94cafd3866a7a56685d5d4a048fa975135299655e896ff8370c8c5061d03ab38644623f8be455c08dfe5f630f152820148 nfcapd.confd
-97e432e884dd1cc8f27c2d7398bb0320164d46dea06c64ad72fa385d190998b3d62356634962f42652daf6e31f237baa2f3f3efad47c3fc38cc6bea799db61cc nfcapd.initd"
+97e432e884dd1cc8f27c2d7398bb0320164d46dea06c64ad72fa385d190998b3d62356634962f42652daf6e31f237baa2f3f3efad47c3fc38cc6bea799db61cc nfcapd.initd
+abe594a95a9320bec1d6ee6af6b75cd4d176526d4b10d07aa7ed79fc292b51c341339ba8e1e468df9ec2aae138b1dd66e3a291921938217835ac33819da9d153 sfcapd.confd
+7a65c80186a8708a27e90a7239d1b44ee919c3bbf8cd1ca07ef5d35a623d0dce5eac516b65ba7a98c5fcfab5bad6c15e1f03af38a06eb6280afd1c1f0f52cee4 sfcapd.initd"
diff --git a/main/nfdump/sfcapd.confd b/main/nfdump/sfcapd.confd
new file mode 100644
index 0000000000..d7ef8bfc49
--- /dev/null
+++ b/main/nfdump/sfcapd.confd
@@ -0,0 +1,64 @@
+# Config file for /etc/init.d/sfcapd
+
+# Port we listen on
+# defaults to 6343
+#PORT=6343
+
+# Hostname/address we bind on
+# default is any available
+BINDHOST=127.0.0.1
+
+# IPv4 only
+#IPV4=no
+
+# IPv6 only
+#IPV6=no
+
+# Join a specific Multicast group
+#MULTICASTGROUP=
+
+# Become a packet repeater
+#REPEAT=desthost/port
+
+# Ident string, specify the name of the router
+#IDENT=
+
+# Base Directory for output files
+BASEDIR="/var/log/nfcapd"
+
+# Source is one or more sources: Ident,IP,base_directory
+# If you specificy SOURCE, do not specifiy IDENT or BASEDIR
+#SOURCE="Foo,192.168.1.1,/var/log/nfcapd/foo Bar,192.168.1.2,/var/log/nfcapd/bar"
+
+# Sample Rate
+# defaults to source
+#SAMPLERATE=
+
+# additional directory sub hierarchy (default none)
+#SUBDIR="%Y/%m/%d"
+
+# Extensions to be stored in the netflow data
+#EXTENSIONS="all"
+
+# How often to rotate the files (in seconds)
+#INTERVAL=300
+
+# Do we align rotation with next even interval
+#ALIGN=no
+
+# Run a command at the end of every interval
+#ROTATECMD=""
+
+# Auto expire old files (yes/no)
+#AUTOEXPIRE=no
+
+# User / Group
+# Defaults to nobody
+#UID=nobody
+#GID=nobody
+
+# Buffer length in bytes (to reduce lost packets)
+BUFFLEN=1024000
+
+# Compress the flows with LZO (yes/no)
+COMPRESS=yes
diff --git a/main/nfdump/sfcapd.initd b/main/nfdump/sfcapd.initd
new file mode 100644
index 0000000000..1a2171f239
--- /dev/null
+++ b/main/nfdump/sfcapd.initd
@@ -0,0 +1,50 @@
+#!/sbin/openrc-run
+
+depend() {
+ need net
+ after firewall
+}
+
+command=/usr/bin/sfcapd
+pidfile=/var/run/${SVCNAME}/${SVCNAME}.pid
+: ${exec_user:=$UID}
+: ${exec_group:=$GID}
+: ${exec_dir:=$BASEDIR}
+
+start_pre() {
+ checkpath --directory --owner "${exec_user:-nobody}:${exec_group:-nobody}" "${exec_dir:-/var/log/nfcapd}"
+ checkpath --directory --owner "${exec_user:-nobody}:${exec_group:-nobody}" "${pidfile/$SVCNAME.pid}"
+}
+
+start() {
+ ebegin "Starting ${SVCNAME}"
+ start_pre()
+
+ [ -n "${SOURCE}" ] && SOURCE=`echo -n "${SOURCE}" | sed 's/ / -n /g'`
+ [ "${IPV4}" == "yes" ] && command_args="${command_args} -4"
+ [ "${IPV6}" == "yes" ] && command_args="${command_args} -6"
+ [ "${ALIGN}" == "yes" ] && command_args="${command_args} -w"
+ [ "${AUTOEXPIRE}" == "yes" ] && command_args="${command_args} -e"
+ [ "${COMPRESS}" == "yes" ] && command_args="${command_args} -z"
+ for optname in p:PORT b:BINDHOST j:MULTICASTGROUP i:IFACE R:REPEAT \
+ I:IDENT l:BASEDIR n:SOURCE s:SAMPLERATE S:SUBDIR \
+ T:EXTENSIONS t:INTERVAL u:UID g:GID \
+ B:BUFFLEN ; do
+ opt="${optname/:*}" optvar="${optname/*:}"
+ eval optvalue="\$$optvar"
+ [ -n "$optvalue" ] && command_args="${command_args} -${opt} ${optvalue}"
+ done
+
+ # Handle remote command as a special case
+ if [ -n "${ROTATECMD}" ]; then
+ start-stop-daemon --start -b --exec $command \
+ --pidfile $pidfile \
+ -- ${command_args} -x "${ROTATECMD}" -P $pidfile
+ else
+ start-stop-daemon --start -b --exec $command \
+ --pidfile $pidfile \
+ -- ${command_args} -P $pidfile
+ fi
+
+ eend $?
+}