测试环境:

1、RHEL 6.3 X64 最小化安装

2、已经安装cacti 0.8.8

3、已经配置epel源

4、已经在cisco路由器上配置好flow-export了。

安装和配置过程:

1、安装flow-tools

  yum install flow-tools

2、install flowview

   wget http://docs.cacti.net/_media/plugin:flowview-v1.1-1.tgz

   tar zxvf plugin:flowview-v1.1-1.tgz

    mv plugin:flowview-v1.1-1.tgz flowview-v1.1-1.tgz

    cp flowview /var/www/html/cacti/plugin

    cp /var/www/html/cacti/plugin/flowview/flow-capture /etc/init.d/flow-capture

    vi /etc/init.d/flow-capture

    找到下面的内容并更改为如下:

    $cacti_base = '/var/www/html/cacti';

2.5 修改配置:

vi  /var/www/html/cacti/include/config.php 如下:
$plugins = array();
$plugins[] =  'flowview';

保存退出。

3、登录cacti,找到Configuration-》Plugin Management》安装flowview。

   然后在Configuration-》setting-》Misc中,找到Flows Directory,并填入路径,比如/var/netflow. 这个路径只要存在即可。主要是用来放置获取到的数据包的。

    如果你的主机上没有这个文件夹。创建即可:

     mkdir -p /var/netflow

     然后点击“save”

4、启动数据包获取

    /etc/init.d/flow-capture start

    ps -ef| grep flow

   root     11333     1  0 13:17 ?        00:00:00 /usr/bin/flow-capture -w /var/netflow/router/router 0/0/2055 -S5 -V5 -z 0 -n 1439 -e 2880 -N -1

5、在cacti中,点击上面的“flow”按钮,然后在listeners中新建一个listener,保存。比如router。

6、按道理应该在cacti的flow插件中de fliter查看数据包捕获的情况。但实际情况下,根本看不到结果。目前没有找到原因。作为替代方案,我们可以使用如下方法查看捕获情况。

    在cacti的/var/netflow目录中,你会发现已经出现一个router文件夹。其中还有以日期命名的文件夹。里面有很多文件。比如我的:

   ll /var/netflow/router/2014-10-25/

     

ft-v05.2014-10-25.134601+0800   

ft-v05.2014-10-25.142601+0800   

ft-v05.2014-10-25.150601+0800

如何查看其中的内容呢?方法如下:

flow-cat /var/netflow/router/2014-10-25/ft-v05.2014-10-25.132801+0800 | flow-stat -f8

#  --- ---- ---- Report Information --- --- ---

#

# Fields:    Total

# Symbols:   Disabled

# Sorting:   None

# Name:      Destination IP

#

# Args:      flow-stat -f8 

#

#

# IPaddr         flows                 octets                packets

#

172.16.11.213    2                     432                   3

192.168.40.1     1                     100000                1000

172.16.11.211     10                    12451                 356445


最后:cisco哪些设备可以启用flow-export呢?

1、路由器上都是可以的

2、从4500路由器开始向上都是可以的。3750就别想了。


在路由器上如何配置呢?

interface F0/3

 ip address 172.16.11.212 255.255.255.0

 ip route-cache flow 

 ip flow ingress

 ip flow egress

 

ip flow-export version 5

ip flow-export destination 172.16.22.100 2055

ip flow-cache timeout active 5

ip flow-cache timeout inactive 15