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@gmail.com>
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
>
--
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel