watchdogd icon indicating copy to clipboard operation
watchdogd copied to clipboard

Add command to list currently subscribed clients

Open franzflasch opened this issue 1 year ago • 5 comments

I thought it would be useful to have a list of subscribed clients and get some status information about them. So I added a new supervisor cmd to log that information on request.

franzflasch avatar Aug 02 '24 05:08 franzflasch

FYI: the output looks like this:

watchdogd[732]: Subscribed clients:
watchdogd[732]: process: 1, id: 1, pid: 733, label: watchdogd-client-example, timeout: 3000ms, time-left: 2483ms

And in case timerfd_gettime returns an error (e.g. when watchdogd is disabled):

watchdogd[732]: Subscribed clients:
watchdogd[732]: process: 1, id: 1, pid: 733, label: watchdogd-client-example, timeout: 3000ms, time-left: 0ms

It just returns 0ms instead of an invalid value.

franzflasch avatar Aug 02 '24 05:08 franzflasch

Any chance that this gets merged?

franzflasch avatar Oct 03 '24 08:10 franzflasch

Sorry for the late reply, I've been swamped with other duties, yet I have been thinking about this one long and hard in the background, unsure how to reply ...

... because I really don't want to discourage you, but I would like to get the client list displayed by watchdogctl, on stdout, and not sent to syslog. If a user wants to send it to syslog, they can pipe it to the logger command, or similar.

This means extra work on the IPC between the daemon and the client (I've done this in other projects of mine already, e.g., finit, mrouted, and a few others).

troglobit avatar Oct 03 '24 08:10 troglobit

Thanks for your reply. Having it as stdout by watchdogctl would also be my preferred solution. However I wanted to make this change as minimal as possible. If you plan to do it as stdout, you can just decline it, fine for me.

franzflasch avatar Oct 03 '24 08:10 franzflasch

That's just it, I have no current plans to work on watchdogd, so if you'd like to have a go at it I'm happy to review.

troglobit avatar Oct 03 '24 08:10 troglobit

Thank you for this contribution! I've adopted it and added JSON output support as well.

troglobit avatar Nov 23 '25 11:11 troglobit