|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] RPC interface for xenmon
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
--
xenmon_xmlrpc.patch
Description: Text Data
xmlrpcserver.py
Description: Text Data
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|