Xen traffic usage (bandwidth) monitor, alerter and automatic null routing.
Since I saw very few Xen monitoring and management tools available, I have quickly decided to roll my own. This will check on a regular interval your Xen guests and record their traffic usage (TX and RX but can be modified to do either/or) to a MongoDB database. If their traffic exceeds the set amount (set per VM/plan) then the IP(s) will automatically be null routed and you (and the client) will be emailed. This null route is in place for the rest of the month until the allowance is reset (you can obviously update the VMs allowance through the
addvm.rb script if the client pays more or is allocated more).
This is coded in Ruby.
Use at your own risk, it currently only supports the
xm toolstack but support for the
xl toolstack can easily be implemented since only the
xm list function is required.
Source code and documentation: https://github.com/will3942/xen-bandwidth-monitor
Full write-up and tutorial: blog.will3942.com/xen-bandwidth-monitoring
Hopefully this helps someone!