Get Paid to Participate - up to $1 per post!     Twitter     Facebook     Google+
Hosting Discussion
 

forgot password?



Reply


Old
  Post #1 (permalink)   11-15-2009, 12:21 AM
HD Newbie
 
Join Date: Sep 2009
Posts: 28

Status: e-Sensibility is offline
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:
Code:
tar -xzvf bwpoll.tar.gz
Code:
cd bwpoll/server/
Now move the bwpoll directory located herein to where it expects to live:
Code:
mv bwpoll /etc/bwpoll
Code:
cd /etc/bwpoll
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.
Code:
chmod 500 *
Code:
chmod 555 poll.pl ; chmod 555 Connection.pm
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:
Code:
echo "perl /etc/bwpoll/spawn.pl" >> /etc/rc.d/rc.local
And we'll also add a user who will poll:
Code:
useradd -d /dev/null/ bw
And configure a password for that user:
Code:
passwd bw
Now everything is set up on the Dom0 side. To start the scripts without rebooting, simply execute spawn.pl manually (as root):

Code:
perl /etc/bwpoll/spawn.pl
===============================================

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:
Code:
tar -xzvf bwpoll.tar.gz
Code:
cd bwpoll/client/
Now move the bwpoll directory located herein to where it expects to live:
Code:
mv bwpoll /etc/bwpoll
Code:
cd /etc/bwpoll
Next, edit /etc/bwpoll/bwpoll.pl adding in the appropriate values for username, password and hostname:
Code:
vi /etc/bwpoll/bwpoll.pl
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!
Code:
perl /etc/bwpoll/bwpoll.pl
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!
__________________
Experience e-Sensibility
15k SAS SAN-Based Storage
REBOOTLESS Kernel Security Updates
100% Uptime SLA -- True High Availability
 
 
 


Old
  Post #2 (permalink)   01-22-2010, 09:43 AM
HD Newbie
 
Join Date: Jan 2010
Posts: 26

Status: zippyhosts is offline
Wonderful tutorial . thanks for it
 
 
 
Reply

Thread Tools

New Post New Post   Old Post Old Post
Posting Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Sponsored By: