10 Haziran 2014 Salı

Nfdump ,Nfsen installation and configuration

NFDUMP

Os: Debian wheezy 7.5
#apt-get install gcc flex librrd-dev make byacc flex autoconf
#cd  /opt
# wget http://sourceforge.net/projects/nfdump/files/stable/nfdump-1.6.12/nfdump-1.6.12.tar.gz/download
#tar xzvf nfdump-1.6.12.tar.gz
#cd /nfdump-1.6.12
# ./configure --enable-nfprofile --enable-nftrack --enable-sflow
#make
#make install

NFSEN

# apt-get install apache2 libapache2-mod-php5 php5-common libmailtools-perl rrdtool librrds-perl
#cd /opt
#wget http://heanet.dl.sourceforge.net/project/nfsen/stable/nfsen-1.3.6p1/nfsen-1.3.6p1.tar.gz
#tar xzvf nfsen-1.3.6p1.tar.gz
#cd nfsen-1.3.6p1/
#cp etc/nfsen-dist.conf /etc/nfsen.conf
# mkdir -p /data/nfsen
#nano /etc/nfsen.conf
[..]
$BASEDIR = "/data/nfsen";
[..]
$PREFIX  = '/usr/local/bin';#nfdump tools location
[..]
$USER    = "www-data";
[..]
$WWWUSER  = "www-data";
$WWWGROUP = "www-data";
[..]
%sources = (
 'for-Cisco' => {'port'=>'9995','col'=>'#0000ff','type'=>'netflow'},
 'for-Hp&Juniper' => {'port'=>'9996','col'=>'#0000ff','type'=>'sflow'},

);
[..]
$MAIL_FROM   = 'youraccount@yourdomain.ext';
$SMTP_SERVER = 'yoursmtphost.yourdomain.ext';
[..]

# perl -MCPAN -e 'install Socket6'
#which perl
/usr/bin/perl
# ./install.pl /etc/nfsen.conf
Script Ask a question about the perl location , 'which perl' is help you ;)
#cd /data/nfsen/bin/
#./nfsen start
For startup 
#ln -s /data/nfsen/bin/nfsen /etc/init.d/nfsen
#update-rc.d nfsen defaults 20
#ln -s /var/www/nfsen/nfsen.php /var/www/nfsen/index.php
Open browser and http://nfsen-nfdump-ip/nfsen/

If you have an error like this '“Frontend – Backend version missmatch!”'
http://sourceforge.net/p/nfsen/mailman/message/28748240/
or
#nano /var/www/nfsen/nfsen.php
// Session check
-if ( !array_key_exists('backend_version', $_SESSION ) || $_SESSION['backend_version'] !=  $expected_version ) {
+if ( array_key_exists('backend_version', $_SESSION ) && 
+$_SESSION['backend_version'] !=  $expected_version ) {
        session_destroy();
        session_start();
        $_SESSION['version'] = $expected_version;}
###
If you have an error about the 'service nfsen start/stop/reconfig'
Reconfiguring /usr/share/nfsen/bin/nfsen: Subroutine Lookup::pack_sockaddr_in6 redefined at /usr/share/perl5/Exporter.pm line 67.
at /usr/share/nfsen/libexec/Lookup.pm line 43
Subroutine Lookup::unpack_sockaddr_in6 redefined at /usr/share/perl5/Exporter.pm line 67.
at /usr/share/nfsen/libexec/Lookup.pm line 43
Subroutine Lookup::sockaddr_in6 redefined at /usr/share/perl5/Exporter.pm line 67.
at /usr/share/nfsen/libexec/Lookup.pm line 43
Subroutine AbuseWhois::pack_sockaddr_in6 redefined at /usr/share/perl5/Exporter.pm line 67.
at /usr/share/nfsen/libexec/AbuseWhois.pm line 42
Subroutine AbuseWhois::unpack_sockaddr_in6 redefined at /usr/share/perl5/Exporter.pm line 67.
at /usr/share/nfsen/libexec/AbuseWhois.pm line 42
Subroutine AbuseWhois::sockaddr_in6 redefined at /usr/share/perl5/Exporter.pm line 67.
at /usr/share/nfsen/libexec/AbuseWhois.pm line 42
Subroutine AbuseWhois::pack_sockaddr_in6 redefined at /usr/share/nfsen/libexec/AbuseWhois.pm line 44
Subroutine AbuseWhois::unpack_sockaddr_in6 redefined at /usr/share/nfsen/libexec/AbuseWhois.pm line 44
Subroutine AbuseWhois::sockaddr_in6 redefined at /usr/share/nfsen/libexec/AbuseWhois.pm line 44
###
/data/nfsen/libexec/AbuseWhois.pm
/data/nfsen/libexec/Lookup.pm
Change :
use Socket6;
with
Socket6->import(qw(pack_sockaddr_in6 unpack_sockaddr_in6 inet_pton getaddrinfo));

It will work fine ;)


Hiç yorum yok:

Yorum Gönder