nfdump and nfsen 安裝

先安裝nfsen所需要的套件

# yum install -y httpd php wget gcc make rrdtool-devel rrdtool-perl perl-MailTools perl-Socket6 flex byacc
# yum install -y perl-Sys-Syslog
# vim /etc/selinux/config
  set SELINUX=disabled
# sudo service httpd start
# chkconfig httpd on

下載及安裝nfdump

# mkdir /nfsen        
# cd /nfsen
# wget https://sourceforge.net/projects/nfdump/files/stable/nfdump-1.6.13/nfdump-1.6.13.tar.gz
# tar zxvf nfdump-1.6.13.tar.gz
# cd nfdump-1.6.13
# ./configure --enable-nfprofile --enable-nftrack --enable-sflow 
# make && sudo make install

下載安裝nfsen

# cd /nfsen
# wget https://sourceforge.net/projects/nfsen/files/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
# vim etc/nfsen.conf
按下面要求修改nfsen配置文件,其他默认就行
$BASEDIR = "/data/nfsen";
$HTMLDIR    = "/var/www/html/nfsen/";
$USER    = "apache";
$WWWUSER  = "apache";
$WWWGROUP = "apache";
%sources = (
    'BGP'    => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'sflow' },
);
@plugins = (
    # profile    # module
    # [ '*',     'demoplugin' ],
    ['live',     'PortTracker'],
);
# mkdir /data
# chown -R apache:apache /data
# ./install.pl etc/nfsen.conf
# vim /etc/init.d/nfsen
新增下列指令
#!/bin/bash
#
# chkconfig: - 50 50
# description: nfsen
DAEMON=/data/nfsen/bin/nfsen
case "$1" in
		start)
		$DAEMON start
		;;
		stop)
		$DAEMON stop
		;;
		status)
		$DAEMON status
		;;
		restart)
		$DAEMON stop
		sleep 1
		$DAEMON start
		;;
		*)
		echo "Usage: $0 {start|stop|status|restart}"
		exit 1
		;;
esac
exit 0

安裝PortTracker
# cd /nfsen
# cp nfsen-1.3.6p1/contrib/PortTracker/PortTracker.pm /data/nfsen/plugins/
# cp nfsen-1.3.6p1/contrib/PortTracker/PortTracker.php /var/www/html/nfsen/plugins/
# mkdir /data/ports-db
# chown apache:apache /data/ports-db
# nftrack -I -d  /data/ports-db/ 
# cd /etc/init.d/
# chmod +x nfsen
# service nfsen start  
# service firewalld stop
# yum update -y