安装准备,下载apt-ntop-stable.deb包:http://packages.ntop.org/apt-stable/
dpkg -i apt-ntop-stable.deb
apt-get clean all
apt-get update
apt-get install pfring nprobe ntopng ntopng-data n2disk cento nbox
sFlow-RT的安装过程如下,下载JDK:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
在/etc/profile文件中配置JDK环境
export JAVA_HOME=/home/xiaoqiang/jdk1.7.0_79 #这里为jdk安装的绝对路径
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=${JAVA_HOME}/bin:$JRE_HOME/bin:$PATH
下载 sFlow-RT并安装运行
wget http://www.inmon.com/products/sFlow-RT/sflow-rt.tar.gz
tar -xvzf sflow-rt.tar.gz
cd sflow-rt
./start.sh
在含有Openvswitch的网桥节点上执行下面的脚本来进行sFlow的agent建立
#! /bin/bash
COLLECTOR_IP=10.0.0.107 #这个是sFlow-RT所在节点的IP地址
COLLECTOR_PORT=6343
read -p "please input agent ip name: " AGENT_IP
HEADER_BYTES=128
SAMPLING_N=64
POLLING_SECS=10
read -p "please input ovs-bridge name: " BRIDGE
ovs-vsctl -- --id=@sflow create sflow agent=${AGENT_IP} target=\"${COLLECTOR_IP}:${COLLECTOR_PORT}\" header=${HEADER_BYTES} sampling=${SAMPLING_N} polling=${POLLING_SECS} -- set bridge ${BRIDGE} sflow=@sflow
进行验证
root@collector:~# lsof -i :8008
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 6079 root 31u IPv6 33404 0t0 TCP *:8008 (LISTEN)
如果想将ntopng作为sFlow的收集器需进行下面的操作
假设ntopng和sFlow的collector是在同一电脑上,由于6343端口冲突,应该将sFlow的collector关闭,
nprobe --zmq "tcp://*:5556" -i none -n none --collector-port 6343
ntopng -i tcp://127.0.0.1:5556
然后访问http://localhost:3000