Knowledgebase

Portal Home > Knowledgebase > Articles Database > XenServer Bandwidth Poller


XenServer Bandwidth Poller




Posted by e-Sensibility, 11-14-2009, 05:01 PM
Here's a simple set of scripts that enable you to pull network usage stats on XenServer Guests (domU) in a secure manner by polling their VIFs on the XenServer Host (Dom0). These scripts work across reboots, and can easily be used to feed data into graphing utilities like Cacti. Installation: ======================================================== On the Dom0 (host) (the following must be done as root): Unpack the tar.gz archive linked above and cd to the newly created directory: Now move the bwpoll directory located herein to where it expects to live: Next we'll make sure the permissions are correct -- this is very important to ensure that the user we'll create later can't execute arbitrary commands as root. Now that everything is in the right place and permissions are properly set, we'll add a command to /etc/rc.d/rc.local to make sure everything starts on boot: And we'll also add a user who will poll: And configure a password for that user: Now everything is set up on the Dom0 side. To start the scripts without rebooting, simply execute spawn.pl manually (as root): =============================================== Client install (on a domU or another host): =============================================== Dependencies: You must install Net : : SSH : : Perl (broken up because of smileys) from CPAN (or via yum if you have the RPMForge repo enabled) On a guest or separate machine, unarchive the tar.gz file linked at the beginning of this post: Now move the bwpoll directory located herein to where it expects to live: Next, edit /etc/bwpoll/bwpoll.pl adding in the appropriate values for username, password and hostname: That's it! By default if you execute /etc/bwpoll/bwpoll.pl you'll see the current network read/write statistics for each guest (domU) living on the host (dom0) that you've configured!These scripts are extremely easy to extend via perl modules or custom subroutines within bwpoll.pl. If you feel like it, please share how you implement the scripts in your environment and contribute back any modifications you make to this thread. Hope this helps somebody! Last edited by e-Sensibility; 11-14-2009 at 05:12 PM.

Posted by PeHe, 11-16-2009, 07:09 AM
Hmm.. Im sorry but i dont get point of this. Why dont you do all of this in dom0? Theres no need to read data in domU and bypass it to dom0. That way you can insert that data straight to let's say MySQL. And if you are running multiple dom0's you can check statictics for all nodes from one place.

Posted by e-Sensibility, 11-16-2009, 11:47 AM
The point of this is: A. Permissions separation -- The poller user doesn't need privilege in order to get the data with these scripts as it would by default. B. You NEVER want to store data on the Dom0! You run as few services as possible from it, and you should keep them as lightweight as possible. And I'm not sure what you mean by "read data in domU and bypass it to dom0" What these scripts do are take the data from the dom0 and pass it to a domU or any other external machine for further processing/storage. And there's no reason at all why you couldn't, in a few lines, extend the Client script I've provided in order to monitor multiple machines. Last edited by e-Sensibility; 11-16-2009 at 11:50 AM.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read


Language:

Contact us