nfsen 是nfdump的前端显示,是基于perl,php。
nfsen prerequisite
- PHP and Perl:
NfSen is written in PHP and Perl and should run on any *NIX system.
At least Perl 5.6.0 and PHP > 4.1 is required including the Socket and Perl regex extension. - Perl Modules:
NfSen alerting requires the following Perl Modules:
Mail::Header, Mail::Internet
perl module install:
perl -MCPAN -e "install module_name"
最好使用系统自带的perl,使用homebrew升级之后的Perl,没发更改perl的@INC的default value (env -i perl -V
),但@INC的environment value 变了 (perl -V
),后面安装的时候必须使用default value.
- RRD tools
All netflow graphs in NfSen require RRD. At least the RRDs Perl Module is required.
for perl in mac:
sudo perl -MCPAN -e 'CPAN::Shell->notest(install => CPAN::Shell->r)'
sudo perl -MCPAN -e "install Alien::RRDtool"
sudo perl -MCPAN -e "install RRD::Simple"
- Nfdump tools
The nfdump tools are the backend tools for NfSen and will collect and process the netflow data.
Make sure, that you have version 1.5.8 installed. Don't try any version < 1.5.5, or the profiles will not work. You can download nfdump from sourceforge.
./configure --enable-nfprofile
- 安装nfsen之前必须先配置好apache2和php,并且必须知道apache2设置的DocumentRoot,User 和 Group, 一般情况User 和 Group 不会进行更改,默认为
_www
nfsen.conf 更改
在nfsen.conf中有些配置必须进行更改:
- BASEDIR (安装路径)
可以选择BASEDIR = "/usr/local/nfsen";
或者选择安装在apache2 的DocumentRoot下。 (在有些地方安装之后无法启动nfsen,提示Starting nfcapd:(route)open() error existing pid file: Permission denied
,原因不明) - HTMLDIR (php文件的安装路径)
这个必须设置在apache2的DocumentRoot下,否则apache2无法调用这个php文件 - %sources
source中的用户必须都添加col
安装:
sudo ./install.pl etc/nfsen.conf
启动和停止nfsen
sudo ./nfsen start
sudo ./nfsen stop
疑问:
既然在source中已经设置了监控端口(port),那为什么还可以设置profile过滤某个端口的Packet?