作者:张华 发表于:2015-06-10
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明
( http://blog.csdn.net/quqi99 )
1, /etc/neutron/neutron.conf
service_plugins = router,metering
notification_driver=neutron.openstack.common.notifier.rpc_notifier
2, /etc/neutron/metering_agent.ini
debug = True
driver = neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver
measure_interval = 10
report_interval = 3330
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
use_namespaces = True
3, restart neutron-server and neutron-metering-agent
neutron meter-label-rule-create outgoingnet 10.8.0.0/24 --direction egress
neutron meter-label-rule-create incomingnet 10.8.0.0/24 --direction ingress --excluded
这样会生成下列iptables规则,然后可以使用sudo iptables -L -vn -x查看。
-I FORWARD -s 10.8.0.0 #egress
-I FORWARD -d 10.8.0.0 -j RETURN # ingress
注意,在neutron里需要在namespace里查看:
ip netns exec qrouter-77dcb0af-2743-46ce-bf91-a41ac3f3afc1 iptables -t filter -L neutron-meter-FORWARD -vn -x
4, ceilometer,
ceilometer statistics --meter bandwidth --period 60 -q 'resource_id=<meter-label-rule-id>'