port pmacct to -ng
authorNicolas Thill <nico@openwrt.org>
Sun, 12 Nov 2006 10:23:13 +0000 (10:23 +0000)
committerNicolas Thill <nico@openwrt.org>
Sun, 12 Nov 2006 10:23:13 +0000 (10:23 +0000)
SVN-Revision: 5514

net/pmacct/Makefile [new file with mode: 0644]
net/pmacct/files/nfacctd.conf [new file with mode: 0644]
net/pmacct/files/nfacctd.default [new file with mode: 0644]
net/pmacct/files/nfacctd.init [new file with mode: 0644]
net/pmacct/files/pmacctd.conf [new file with mode: 0644]
net/pmacct/files/pmacctd.default [new file with mode: 0644]
net/pmacct/files/pmacctd.init [new file with mode: 0644]

diff --git a/net/pmacct/Makefile b/net/pmacct/Makefile
new file mode 100644 (file)
index 0000000..57509cb
--- /dev/null
@@ -0,0 +1,207 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pmacct
+PKG_VERSION:=0.10.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.ba.cnr.it/~paolo/pmacct/
+PKG_MD5SUM:=0be1ffd9d4bda73575caa3240abbf4cb
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_BUILDDEP:=libpcap
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pmacct/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=pmacct (accounting and aggregation tools)
+  URL:=http://www.ba.cnr.it/~paolo/pmacct/
+endef
+
+define Package/nfacctd/Default
+  $(call Package/pmacct/Default)
+  TITLE:=NetFlow accounting daemon
+endef
+
+define Package/nfacctd
+  $(call Package/nfacctd/Default)
+endef
+
+define Package/nfacctd-mysql
+  $(call Package/nfacctd/Default)
+  TITLE+= with MySQL support
+  DEPENDS+= +libmysqlclient
+endef
+
+define Package/nfacctd-pgsql
+  $(call Package/nfacctd/Default)
+  TITLE+= with PostreSQL support
+  DEPENDS+= +libpq
+endef
+
+define Package/nfacctd-sqlite
+  $(call Package/nfacctd/Default)
+  TITLE+= with SQLite support
+  DEPENDS+= +libsqlite3
+endef
+
+define Package/pmacctd/Default
+  $(call Package/pmacct/Default)
+  DEPENDS+= +libpcap
+  TITLE:=IP pcap-based accounting daemon
+endef
+
+define Package/pmacctd
+  $(call Package/pmacctd/Default)
+endef
+
+define Package/pmacctd-mysql
+  $(call Package/pmacctd/Default)
+  TITLE+= with MySQL support
+  DEPENDS+= +libmysqlclient
+endef
+
+define Package/pmacctd-pgsql
+  $(call Package/pmacctd/Default)
+  TITLE+= with PostreSQL support
+  DEPENDS+= +libpq
+endef
+
+define Package/pmacctd-sqlite
+  $(call Package/pmacctd/Default)
+  TITLE+= with SQLite support
+  DEPENDS+= +libsqlite3
+endef
+
+define Package/sfacctd/Default
+  $(call Package/pmacct/Default)
+  TITLE:=sFlow accounting daemon
+endef
+
+define Package/pmacct-client
+  $(call Package/pmacct/Default)
+  TITLE:=Command-line client to gather data from the IMT plugin
+endef
+
+
+ifneq ($(SDK),)
+  CONFIG_PACKAGE_nfacctd:=m
+  CONFIG_PACKAGE_nfacctd-mysql:=m
+  CONFIG_PACKAGE_nfacctd-pgsql:=m
+  CONFIG_PACKAGE_nfacctd-sqlite:=m
+  CONFIG_PACKAGE_pmacctd:=m
+  CONFIG_PACKAGE_pmacctd-mysql:=m
+  CONFIG_PACKAGE_pmacctd-pgsql:=m
+  CONFIG_PACKAGE_pmacctd-sqlite:=m
+endif
+
+define Compile/Template
+
+$(PKG_BUILD_DIR)/nfacctd-$(1) $(PKG_BUILD_DIR)/pmacctd-$(1): $(PKG_BUILD_DIR)/.configured
+       -$(MAKE) -C $(PKG_BUILD_DIR) distclean
+       $(call Build/Configure/Default, \
+               --with-pcap-includes="$(STAGING_DIR)/usr/include" \
+               --with-pcap-libs="$(STAGING_DIR)/usr/lib" \
+               $(2) \
+               , \
+               LIBS="-lz" \
+       );
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
+               all
+       mv -f $(PKG_BUILD_DIR)/src/nfacctd $(PKG_BUILD_DIR)/nfacctd-$(1)
+       mv -f $(PKG_BUILD_DIR)/src/pmacctd $(PKG_BUILD_DIR)/pmacctd-$(1)
+
+$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/nfacctd-$(1) $(PKG_BUILD_DIR)/pmacctd-$(1)
+
+endef
+
+
+define Install/Template
+
+define Package/$(1)/conffiles
+/etc/default/$(3)
+/etc/$(3).conf
+endef
+
+define Package/$(1)/install
+       install -d -m0755 $$(1)/usr/sbin
+       install -m0755 $(PKG_BUILD_DIR)/$(2) $$(1)/usr/sbin/$(3)
+       install -d -m0755 $$(1)/etc
+       install -m0644 ./files/$(3).conf $$(1)/etc/
+       install -d -m0755 $$(1)/etc/default
+       install -m0644 ./files/$(3).default $$(1)/etc/default/$(3)
+       install -d -m0755 $$(1)/etc/init.d
+       install -m0755 ./files/$(3).init $$(1)/etc/init.d/$(3)
+endef
+
+endef
+
+
+ifneq ($(CONFIG_PACKAGE_nfacctd)$(CONFIG_PACKAGE_pmacctd),)
+  $(eval $(call Compile/Template,basic))
+  $(eval $(call Install/Template,nfacctd,nfacctd-basic,nfacctd))
+  $(eval $(call Install/Template,pmacctd,pmacctd-basic,pmacctd))
+endif
+ifneq ($(CONFIG_PACKAGE_nfacctd-mysql)$(CONFIG_PACKAGE_pmacctd-mysql),)
+  $(eval $(call Compile/Template,mysql, \
+               --enable-mysql \
+               --with-mysql-includes="$(STAGING_DIR)/usr/include" \
+               --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql" \
+               , \
+               LIBS='-lz' \
+  ))
+  $(eval $(call Install/Template,nfacctd-mysql,nfacctd-mysql,nfacctd))
+  $(eval $(call Install/Template,pmacctd-mysql,pmacctd-mysql,pmacctd))
+endif
+ifneq ($(CONFIG_PACKAGE_nfacctd-pgsql)$(CONFIG_PACKAGE_pmacctd-pgsql),)
+  $(eval $(call Compile/Template,pgsql, \
+               --enable-pgsql \
+               --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
+               --with-pgsql-libs="$(STAGING_DIR)/usr/lib" \
+  ))
+  $(eval $(call Install/Template,nfacctd-pgsql,nfacctd-pgsql,nfacctd))
+  $(eval $(call Install/Template,pmacctd-pgsql,pmacctd-pgsql,pmacctd))
+endif
+ifneq ($(CONFIG_PACKAGE_nfacctd-sqlite)$(CONFIG_PACKAGE_pmacctd-sqlite),)
+  $(eval $(call Compile/Template,sqlite, \
+               --enable-sqlite3 \
+               --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
+               --with-sqlite3-libs="$(STAGING_DIR)/usr/lib" \
+  ))
+  $(eval $(call Install/Template,nfacctd-sqlite,nfacctd-sqlite,nfacctd))
+  $(eval $(call Install/Template,pmacctd-sqlite,pmacctd-sqlite,pmacctd))
+endif
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/pmacct-client/install
+       install -d -m0755 $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/src/pmacct $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,nfacctd))
+$(eval $(call BuildPackage,nfacctd-mysql))
+$(eval $(call BuildPackage,nfacctd-pgsql))
+$(eval $(call BuildPackage,nfacctd-sqlite))
+$(eval $(call BuildPackage,pmacctd))
+$(eval $(call BuildPackage,pmacctd-mysql))
+$(eval $(call BuildPackage,pmacctd-pgsql))
+$(eval $(call BuildPackage,pmacctd-sqlite))
+$(eval $(call BuildPackage,pmacct-client))
diff --git a/net/pmacct/files/nfacctd.conf b/net/pmacct/files/nfacctd.conf
new file mode 100644 (file)
index 0000000..27b8956
--- /dev/null
@@ -0,0 +1,29 @@
+!
+! nfacctd configuration example
+!
+! debug: true
+daemonize: true
+pidfile: /var/run/nfacctd.pid
+! aggregate_filter[dummy]: src net 192.168.0.0/16
+aggregate: src_host, dst_host
+! plugin_buffer_size: 1024
+! nfacctd_port: 5678
+! nfacctd_time_secs: true
+! nfacctd_time_new: true
+plugins: memory
+imt_buckets: 65537
+imt_mem_pools_size: 65536
+! imt_mem_pools_number: 0
+! plugins: mysql
+! plugins: pgsql
+! plugins: sqlite3
+! sql_db: pmacct
+! sql_table: acct
+! sql_table_version: 2
+! sql_passwd: arealsmartpwd
+! sql_user: pmacct
+! sql_refresh_time: 90
+! sql_optimize_clauses: true
+! sql_history: 10m
+! sql_history_roundoff: mh
+! networks_file: ./networks.example
diff --git a/net/pmacct/files/nfacctd.default b/net/pmacct/files/nfacctd.default
new file mode 100644 (file)
index 0000000..9315b28
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-f /etc/nfacctd.conf"
diff --git a/net/pmacct/files/nfacctd.init b/net/pmacct/files/nfacctd.init
new file mode 100644 (file)
index 0000000..ac2d12e
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+BIN=nfacctd
+DEFAULT=/etc/default/$BIN
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       mkdir -p $RUN_D
+       $BIN $OPTIONS
+}
+
+stop() {
+       [ -f $PID_F ] && kill -INT $(cat $PID_F)
+}
diff --git a/net/pmacct/files/pmacctd.conf b/net/pmacct/files/pmacctd.conf
new file mode 100644 (file)
index 0000000..e7e4892
--- /dev/null
@@ -0,0 +1,27 @@
+!
+! pmacctd configuration example
+!
+! debug: true
+interface: vlan1
+daemonize: true
+pidfile: /var/run/pmacctd.pid
+pmacctd_id: 1
+aggregate: src_host,dst_host
+! aggregate: src_net,dst_net
+plugins: memory
+imt_buckets: 65537
+imt_mem_pools_size: 65536
+! imt_mem_pools_number: 0
+! plugins: mysql
+! plugins: pgsql
+! plugins: sqlite3
+! sql_db: pmacct
+! sql_table: acct
+! sql_table_version: 2
+! sql_passwd: arealsmartpwd
+! sql_user: pmacct
+! sql_refresh_time: 90
+! sql_optimize_clauses: true
+! sql_history: 10m
+! sql_history_roundoff: mh
+! networks_file: ./networks.example
diff --git a/net/pmacct/files/pmacctd.default b/net/pmacct/files/pmacctd.default
new file mode 100644 (file)
index 0000000..3c06f08
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-f /etc/pmacctd.conf"
diff --git a/net/pmacct/files/pmacctd.init b/net/pmacct/files/pmacctd.init
new file mode 100644 (file)
index 0000000..6498324
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+BIN=pmacctd
+DEFAULT=/etc/default/$BIN
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       mkdir -p $RUN_D
+       $BIN $OPTIONS
+}
+
+stop() {
+       [ -f $PID_F ] && kill -INT $(cat $PID_F)
+}