Ubuntu 14.04 LTS nfsen

This will have to do until i figure out how to deal with smartos images

cp /opt/json/templates/kvm-1.json /opt/json/nfsen-1.json

edit json file to your spec

vi nfsen-1.json

{
“hostname”: “nfsen-1”,
“alias”: “nfsen-1.computerking.ca”,
“vnc_port”: “40004”,
“ram”: “1024”,
“vcpus”: “1”,
“domainname”: “computerking.ca”,
“brand”: “kvm”,
“resolvers”: [
“172.16.0.3”,
“8.8.8.8”,
“8.8.4.4”
],
“disks”: [
{

“size”: 10240,
“model”: “virtio”,
“boot”: true
}
],
“nics”: [
{
“ip”: “172.16.0.4”,
“model”: “virtio”,
“nic_tag”: “switch0”,
“netmask”: “255.255.255.0”,
“gateway”: “172.16.0.1”
}
]
}
vmadm create -f /opt/json/ubuntu-12.04-64-2.json
vmadm stop -F c0edd651-feeb-45a2-bb0d-ea79d1b3a6fc
cp /opt/softwars/isos/ubuntu-14.04.1-server-amd64.iso /zones/c0edd651-feeb-45a2-bb0d-ea79d1b3a6fc/root/boot.iso
vmadm boot c0edd651-feeb-45a2-bb0d-ea79d1b3a6fc order=cd,once=d cdrom=/boot.iso,ide

vnc and do install about the only notable thing i change from the defaults is not using lvm and adding ssh server for obvious reasons

apt-get update
apt-get dist-upgrade
reboot

apt-get install build-essential flex librrd-dev libtool autoconf bison

<<< test this might not be complete see above apt-get install gcc flex librrd-dev make>>>

apt-get install rrdtool libmailtools-perl librrds-perl libio-socket-ssl-perl

apt-get install apache2 libapache2-mod-php5 php5-common

apt-get install softflowd

cd /usr/local/src/

wget http://downloads.sourceforge.net/project/nfdump/stable/nfdump-1.6.12/nfdump-1.6.12.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnfdump%2F&ts=1411847324&use_mirror=superb-dca3
mv nfdump-1.6.12.tar.gz\?r\=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnfdump%2F nfdump-1.6.12.tar.gz
tar -xzvf nfdump-1.6.12.tar.gz
cd nfdump-1.6.12/
./configure –enable-nfprofile –enable-nftrack –enable-sflow
make
make install

wget http://downloads.sourceforge.net/project/nfsen/stable/nfsen-1.3.6p1/nfsen-1.3.6p1.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnfsen%2F&ts=1411846853&use_mirror=tcpdiag
mv nfsen-1.3.6p1.tar.gz\?r\=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnfsen%2F nfsen-1.3.6p1.tar.gz
tar -xzvf nfsen-1.3.6p1.tar.gz
cd nfsen-1.3.6p1/

$USER = “www-data”;

$WWWUSER = “www-data”;
$WWWGROUP = “www-data”;

$BUFFLEN = 2000;

%sources = (
‘local1’ => { ‘port’ => ‘19995’, ‘col’ => ‘#0000ff’, ‘type’ => ‘netflow’ },
);

$MAIL_FROM     = ‘youraccount@yourdomain.ext’;

cp /usr/local/src/nfsen-1.3.6p1/nfsen-dist.conf /etc/nfsen.conf

mkdir -p /data/nfsen

/usr/local/src/nfsen-1.3.6p1/install.pl /etc/nfsen.conf

getting this error still trying to track it down

Can not get semaphore: at libexec/Nfsync.pm line 48.

 

Not sure if i need to do this did anyhow still errors also add apache info here
<<<chown -R www-data:www-data /data/nfsen
chown -R www-data:www-data /var/www/nfsen
ln -s /var/www/nfsen/nfsen.php /var/www/nfsen/index.php>>>

ln -s /data/nfsen/bin/nfsen /etc/init.d/nfsen
update-rc.d nfsen defaults 20

Add this to apache

<VirtualHost *:80>
ServerAdmin ryan@computerking.ca
DocumentRoot /var/www/nfsen
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory “/var/www/nfsen”>
Options FollowSymLinks
AllowOverride None
AuthType Basic
AuthName “NFSEN Reserved Area”
AuthUserFile /etc/apache2/nfsen_passwd
Require valid-user
</Directory>

</VirtualHost>

apt-get install apache2-utils
htpasswd -c /etc/apache2/nfsen_passwd c0mputerking
chown www-data:www-data /etc/apache2/nfsen_passwd
chmod 660 /etc/apache2/nfsen_passwd
/etc/init.d/apache2 restart

 

Some things

vi /etc/nfsen.conf

Making changes

vi /etc/nfsen.conf
cd /usr/local/src/nfsen-1.3.6p1
./install.pl /etc/nfsen.conf
/etc/init.d/nfsen stop
/etc/init.d/nfsen reconfig
/etc/init.d/nfsen start
If adding a new source i get error and have to remove source then let reconfig add it
rm -r /data/nfsen/profiles-data/live/localhost/
/etc/init.d/nfsen reconfig
/etc/init.d/nfsen start

Some nfdump commands

nfdump -R /data/nfsen/profiles-data/live/router-1/ -s port/bytes
nfdump -R /data/nfsen/profiles-data/live/router-1/ -s srcip/bytes -n 10
nfdump -R /data/nfsen/profiles-data/live/router-1/ -s srcip/bytes ‘dst net externalnetwork/24’
nfdump -R /data/nfsen/profiles-data/live/router-1/ -s srcip/bytes ‘src net externalnetwork/24’

 

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.