WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] RPC interface for xenmon

To: "Diwaker Gupta" <diwaker.lists@xxxxxxxxx>
Subject: Re: [Xen-devel] RPC interface for xenmon
From: "Jayesh Salvi" <jayeshsalvi@xxxxxxxxx>
Date: Tue, 4 Apr 2006 00:06:34 -0500
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Kyle Mestery <kmestery@xxxxxxxxxxx>
Delivery-date: Mon, 03 Apr 2006 22:06:56 -0700
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=rWWx31lkZAyEylix5jbwDi+zc8pLibSq2C6GC+2EyWYZTFr6WpN8eGbC3CLKCxOnRI+dFHE5KYZkLxqpyslHJN8qWflVdUkMG49NrPe/whOdG136+CuC9fwNvdY8CVoNFVmiMtLfON1q0vR760aoiTxe9e7uCsO9NcOjp3ccXbA=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <891be9410604021147r29831778jc22cb7c8bec7d244@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <871640aa0604021045g1aa40850mb2ab6b962706948f@xxxxxxxxxxxxxx> <891be9410604021147r29831778jc22cb7c8bec7d244@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi,

Here is a patch that makes xenmon run in server-client mode doing XML-RPC. I have used xmlrpclib (that comes in-built with python 2.2+) and xmlrpcserver.py (attached).

I have added two options to the script in addition to the already available ones.
  -s, --server          publish numbers on XML-RPC server
  -rREMOTE, --remote=REMOTE
                        Display stats from remote server

When run in server mode the script will listen for XML-RPC requests. A thread is forked that calls collect_stats function (which I copy-pasted from show_livestats) that collects data from xenbaked and stores in some global variables. A XenmonRequestHandler class publishes a remote function 'getstats' which is called by the RPC client to get stats.

When run in client mode, giving it the RPC server name, this script connects to the remote server and collects the stats. The display_stats() function (code borrowed from show_livestats) does this remote call and displays the retrieved stat data.

Example run:
Server:
xenmon.py -s
Client:
xenmon.py -r<remote_server_name>

Problems:
There are some problems in this script mainly because of my lack of understanding the original code and my being a python newbie.
1. The script running in server mode hogs around 99% CPU. I don't know why that is happening, but I guess I am collecting stats too frequently. I could not figure out the part of the code which decides how frequently this polling should be done. Could someone have a look?
2. By adding two more options, I have done something wrong in OptionParser code, causing the --live option not being reached. This should be a minor mistake and someone knowing OptionParser code better and quickly tell the mistake. Please let me know what is it.

I have used the xmlrpcserver script by Fredrik Lundh. As the script says it is free for use in as is form. I am attaching it here, it could be found on net as well. This script must be in pwd while running xenmon in server mode.

Please let me know the bugs you find in here.

Thanks,
Jayesh
------------------------------------------------------------------------
Everything you can imagine is real


On 4/2/06, Diwaker Gupta <diwaker.lists@xxxxxxxxx> wrote:
> I read about RPC interface for xenmon in this presentation:
> www.xensource.com/files/xs0106_xenmon_brief.pdf
>
> Has such interface been implemented yet by anyone?

Not yet. Patches are always welcome! :-)

Diwaker
--
Web/Blog/Gallery: http://floatingsun.net/blog



--

Attachment: xenmon_xmlrpc.patch
Description: Text Data

Attachment: xmlrpcserver.py
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>