[Samba] Directly Get CTDB or SMB Status/Stats?
martin at meltin.net
Wed Oct 21 06:31:54 UTC 2020
On Tue, 20 Oct 2020 19:03:03 -0400, Robert Buck via samba
<samba at lists.samba.org> wrote:
> Is there a way to get CTDB or Samba status/stats w/o forking a process? I
> am looking into writing Prometheus exporters for these. I'd prefer to make
> a "C" call in Golang than fork a process and scrape STDOUT. What are my
I can answer the CTDB part...
CTDB's protocol implementation is currently in the ctdb/protocol/
subdirectory of the Samba tree. However, there is no separate client
library for building something outside the Samba source tree. Apart
from technical logistics you would need to be careful with licensing
One compromise would be to either:
* Add long lived helper into the CTDB source that would make the
requests and process the results for you. You could run it once and
talk to it via pipes, a socket or similar.
* A cheaper hack compared to the above might be to add an interactive
mode to the current ctdb command-line tool (ctdb/tools/ctdb.c).
I can see how this might be done. The simplest way avoids the
per-command fork but would open a new client connection via the Unix
domain socket for each command.
This would require scraping results from stdout but the -X option
will help a lot with that for the important commands.
In the longer term this is planned as part of a rewrite of the tool
as part of restructuring.
peace & happiness,
More information about the samba