2,470 Views 3 Replies Last post: Nov 26, 2007 8:30 AM by ecn RSS
kpg123 Rank: Green Belt 157 posts since
Jun 29, 2007
Currently Being Moderated

Oct 21, 2007 11:41 AM

GUI to daemon message passing

I'm looking for an example of how to perform an action from the GUI to asynchronously notify a daemon to perform an action and return a result. For example, if the user were to select a dialog from a menu item called "Get foobars", have a request with the message "GET FOOBARS id" be sent to the daemon and have a result be sent back so that the dialog can display a list of valid foobars for the user to select.

All of the examples of "communication" I've seen so far have been to invoke a daemon with arguments, and the daemons update the database behind the scenes through twisted calls. I thought that the key might be in zenhub.py, but nothing is making sense to me right now.

Does someone have a simple and illustrative example of how to achieve this functionality?

Thank you!


kells
ecn Rank: Green Belt 307 posts since
Feb 7, 2007
Currently Being Moderated
1. Oct 22, 2007 9:07 AM in response to: kpg123
GUI to daemon message passing
You can do this, depending on your definition of "async" from the GUI.
Zope isn't very asynchronous. The method calls occur within a thread.
These threads and the twisted library do not play well together in the
version of zope we are using.

You could add an XML-RPC interface that would find your collector
registered in ZenHub and make requests. This is one way that
distributed RRD data and graph rendering works. See
ZenHub/services/ZenRender.py.

It isn't meant to be simple or illustrative, but zenrender supports "get
me the current value from an RRD file" using the XMLRPC request on port
8090. Fire up ZenHub, connect with zenrender. The service in ZenHub
opens port 8090, and listens for xmlrpc (and http) requests. You can
use XML/RPC calls against this server to reach back through zenhub and
out to zenrender to pull data from remote rrd files. We use this
configuration when collection is being done on the far side of a firewall.

-Eric

kpg123 wrote:

 

 

I'm looking for an example of how to perform an action from the GUI to asynchronously notify a daemon to perform an action and return a result. For example, if the user were to select a dialog from a menu item called "Get foobars", have a request with the message "GET FOOBARS id" be sent to the daemon and have a result be sent back so that the dialog can display a list of valid foobars for the user to select.

All of the examples of "communication" I've seen so far have been to invoke a daemon with arguments, and the daemons update the database behind the scenes through twisted calls. I thought that the key might be in zenhub.py, but nothing is making sense to me right now.

Does someone have a simple and illustrative example of how to achieve this functionality?

Thank you!


kells







_______________________________________________
zenoss-dev mailing list
zenoss-dev@zenoss.org
http://lists.zenoss.org/mailman/listinfo/zenoss-dev


_______________________________________________
zenoss-dev mailing list
zenoss-dev@zenoss.org
http://lists.zenoss.org/mailman/listinfo/zenoss-dev
ecn Rank: Green Belt 307 posts since
Feb 7, 2007
Currently Being Moderated
3. Nov 26, 2007 8:30 AM in response to: kpg123
GUI to daemon message passing
Hey kells,

Today, we have no formal mechanism for setting these port numbers. They
are "invented" as needed.

We could add a standard XML-RPC service to describe the port numbers and
the services available on ZenHub... or maybe we should just make the
XML-RPC mechanism extensible and have a single connection point.

http://dev.zenoss.org/trac/ticket/2387

-Eric

kpg123 wrote:

 

 

Okay, I managed to figure out a crude working version of XML RPC thanks to your hint! Excellent, thank you!

Just to make sure that I don't accidentally clobber any toes, what's the preferred method for allocating port numbers and distributing that information inside of service + zenhub / daemon / zenoss? ie A configuration file that people append to in order to prevent conflicts and allow both Zope and external daemons to figure out what ports go with what service.

Thank you!


kells







_______________________________________________
zenoss-dev mailing list
zenoss-dev@zenoss.org
http://lists.zenoss.org/mailman/listinfo/zenoss-dev


_______________________________________________
zenoss-dev mailing list
zenoss-dev@zenoss.org
http://lists.zenoss.org/mailman/listinfo/zenoss-dev

More Like This

  • Retrieving data ...

Bookmarked By (0)