看板介绍
这是一个基于 goflow2 日志的 NetFlow 排名看板。系统后台持续增量采集日志,识别内外网流向并按分钟聚合入库,再通过网页展示各网段的上传下载排行,支持时间范围查询,适合轻量部署。
实现效果
用于查看网络中上传和下载排行前十的主机设备相关信息,如图所示
部署参考
路由器设置
conf t
flow exporter NetFlow-FE
! 指向部署系统的 ip
destination 192.168.1.250
transport udp 9995
export-protocol netflow-v9
exit
! 优化设置,尽可能减少接收到的数据量
flow record Minimal-FR
match ipv4 source address
match ipv4 destination address
collect counter bytes long
collect counter packets long
exit
flow monitor NetFlow-FM
record Minimal-FR
exporter NetFlow-FE
cache timeout active 60
cache timeout inactive 15
exit
! 此处示例是应用在 vlan6,自行修改
interface Vlan6
ip flow monitor NetFlow-FM input
ip flow monitor NetFlow-FM output
end
! 查看配置结果
show flow exporter statistics
show flow monitor NetFlow-FM cache
系统部署
详见开源地址:wobby89/TopClient
优化设置
需要设置文件轮询,以防止 log 文件过大,数据无法实时刷新
# 创建文件
touch /etc/logrotate.d/goflow2
# 写入以下内容,注意修改成自己的 console.log 目录:
# vim /etc/logrotate.d/goflow2
/opt/docker/monitor/console.log {
su root root
# 如果是监控多个网段,需要按需求扩大一下这个size,不建议超过 500M
size 200M
rotate 3
missingok
notifempty
copytruncate
nocompress
}