Process monitoring using D-Bus server client model

João Valverde backup95 at netcabo.pt
Sun Jun 1 21:01:40 PDT 2008


Hi,

I need some help with some D-BUs concepts... I'm not finding a lot of 
documentation and furthermore I'm not very proficient using OOP, GObject 
even less so.

I'm trying to write a program to log some daemon messages and monitor 
its status using dbus. The daemon is working well using the low-level 
API, I can track its signals using dbus-monitor and I don't have any 
issues there. The daemon registers a well-know name with the system bus 
and generates a signal for each event (internal to the daemon) of 
interest. That signal is sent to the dbus system daemon. I just have to 
create the message, append some arguments and send/flush it down the 
connection. This is the proper procedure to broadcast signals I believe. 
So far so good...

My problem is the client.  I'm trying to use the Glib bindings for the 
client. What do I need to proxy to receive daemon signals and status? 
What are the signals to detect if the daemon comes online or goes 
offline (for example I'm writing a GUI logging program and want to know 
if the daemon is started or sigkilled from the command line)? I can 
write a custom "hello" signal to know when the daemon wakes up but I'd 
like to know if it dies suddenly too. I don't know if the system bus 
auto generates some signal for that or what. Maybe I need to keep two 
proxies for that, one to the bus and the other to the daemon? And what 
are the signal names that I should connect to? All I see using 
dbus-monitor is "NameOwnerChanged", even when my daemon dies. If I only 
allow a single daemon instance to run and accept replacement, there are 
situations where I don't care if the name owner changes (reloading a 
config file without downtime for example)...

I would also like to ask if it's considered good practice to 
indiscriminately broadcast events to the system bus, even if no one is 
listening (my daemon could potentially generate a lot of traffic...) or 
whether I should set up a one-on-one connection? Maybe do a handshake 
over the system bus and then set up a peer to peer connection?

Thank you very much your help,

João Valverde


More information about the dbus mailing list