centos7安装nfsen方法

1、安装rrdtool及所需组件

yum install perl-rrdtool rrdtool rrdtool-devel rrdutils flex byacc

2、安装perl模块

yum install perl-Socket6 perl-MailTools perl-Mail-Sender

3、下载并安装Nfdump工具

mkdir -p /nfsen

wget http://downloads.sourceforge.net/project/nfdump/stable/nfdump-1.6.11/nfdump-1.6.11.tar.gz

tar -zxf nfdump-1.6.11.tar.gz

cd nfdump-1.6.11

./configure --enable-nfprofile --enable-nftrack --with-rrdpath=/usr/local/rrdtool

make

make install

cp bin/nftrack /usr/local/bin/

4、下载并配置Nfsen:

mkdir -p /usr/local/nfsen

wget http://iweb.dl.sourceforge.net/project/nfsen/stable/nfsen-1.3.6p1/nfsen-1.3.6p1.tar.gz

tar zxvf nfsen-1.3.6p1.tar.gz

cd nfsen-1.3.6p1/

cp etc/nfsen-dist.conf etc/nfsen.conf

5、修改Nfsen配置文件:

vim etc/nfsen.conf

#http://www.maxbon.cn

$BASEDIR = "/usr/local/nfsen";

$HTMLDIR = "/data/nfsen/";

$USER = "nobody";

$WWWUSER = "nobody";

$WWWGROUP = "nobody";

%sources = (

'upstream1' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' },

);

6、安装Nfsen:

./install.pl etc/nfsen.conf

7、Nfsen插件PortTracker配置

新建PortTracker数据存放目录:

mkdir -p /home/nfsen/ports-db

chown -R nobody:nobody /home/nfsen/ports-db

8、编辑PortTracker.pm修改$PORTSDBDIR目录: 61行

vim /nfsen/nfsen-1.3.6p1/contrib/PortTracker/PortTracker.pm

my $PORTSDBDIR = "/home/nfsen/ports-db";

9、复制PortTracker插件至相应目录:

cd /nfsen/nfsen-1.3.6p1/contrib/PortTracker

cp PortTracker.pm /usr/local/nfsen/plugins/

cp PortTracker.php /data/nfsen/plugins/

10、修改Nfsen配置文件添加插件信息:211

vim /usr/local/nfsen/etc/nfsen.conf

#http://www.maxbon.cn

@plugins = (

[ 'live', 'PortTracker' ],

);

11、生成PortTracker测试数据:

sudo -u nobody /usr/local/bin/nftrack -I -d /home/nfsen/ports-db/

12、启动Nfsen:

/usr/local/nfsen/bin/nfsen start