openstack 利用neutron-metering-agent 监控l3层流量
##利用neutron-metering-agent 監控l3層流量
環境:ocata版本
openstack的信息監控都是通過ceilometer來獲取,而在基本的組件中沒有將l3層流量的數據push到message中,需要額外安裝openstack-neutron-metering-agent來完成這個功能
然后 ceilometer-agent-notification 通過監聽消息隊列來收取bandwidth信息。
neutron-metering-agent使用的是iptables來監控流量,這里有一些相關的資料可以參考一下
?
一、安裝配置openstack-neutron-metering-agent
https://docs.openstack.org/neutron/rocky/admin/archives/config-agents.html
1.安裝
yum install openstack-neutron-metering-agent
2.配置meter_agent.ini
An OVS-based plug-in such as OVS, NSX, NEC, BigSwitch/Floodlight:
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriverA plug-in that uses LinuxBridge:
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
3.To use the reference implementation, you must set:
driver = iptables
4.Set the?service_plugins?option in the?/etc/neutron/neutron.conf?file on the host that runs?neutron-server:
service_plugins = metering
5.systemctl restart neutron-server
6.啟動neutron-metering-agent
systemctl enable neutron-metering-agent
systemctl start neutron-metering-agent
?
二、 創建bandwidth
使用命令 openstack network meter 或neutron meter-label-create
建議先看看metering官網
這里以監控摸個子網的流入流出流量為例
創建bandwidth
創建子網流入的bandwidth
openstack network meter create name1-in
創建name1-in的規則
openstack network meter rule create --ingress --remote-ip-prefix 0.0.0.0/24 name1-in
創建子網流出的bandwidth
openstack network meter create name1-out
創建name1-out的規則
openstack network meter rule create --egress --remote-ip-prefix 0.0.0.0/24 name1-out
查看創建情況
openstack network meter list
三、iptables 規則查看
說明:
由于neutron-metering-agent統計子網流量的原理是使用iptables
所以可以用iptables -L -nvx 查看規則
注意:上面使用了namespace
所以需要指定namespace
(查看流量統計情況,qrouter 與neutron-meter-l可以通過在/var/log/neutron/metering-agent.log中查看到,前提是前面的debug=true也可以用ip netns list 命令查看namespace,但是無法得知具體是哪個)
?
查看filter的規則
ip netns exec qrouter-6d798340-df16-419d-a56b-35b998b3b763 iptables-save -t filter
?
結合ip netns 相關命令查看規則統計的流量
ip netns exec qrouter-6d798340-df16-419d-a56b-35b998b3b763 iptables -t filter -L neutron-meter-l-44500b94-112 -v -n -x
?
四、 查看數據
完成上面的部分,此時就能在ceilometer中看到bandwidth這個meter項了
gnocchi metric list | grep bandwidth
?
?
原文鏈接:https://blog.csdn.net/energysober/article/details/80027622
?
總結
以上是生活随笔為你收集整理的openstack 利用neutron-metering-agent 监控l3层流量的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PATL2_026 小字辈
- 下一篇: 解决宏基acer电脑开机出现start