[PATCH] CSV output for "samba-tool drs showrepl"

Andrew Bartlett abartlet at samba.org
Wed Oct 24 18:45:16 UTC 2018

On Wed, 2018-10-24 at 17:20 +0200, Flavio Stanchina via samba-technical 
> This patch adds CSV output (option --csv) to "samba-tool drs
> showrepl".
> The output is meant to be equivalent to:
>    repadmin /showrepl /csv
> We use this to monitor our Samba DCs with Check_MK; the AD
> replication 
> plugin for Windows ("ad_replication.bat") sends CSV output and it
> was 
> easy to add it to "drs showrepl".
> For those interested, the Check_MK plugin for the Linux agent is
> simply:
>    #!/bin/sh
>    # ad_replication.sh
>    # Needs patched samba-tool!
>    echo '<<<ad_replication>>>'
>    samba-tool drs showrepl --csv 2>/dev/null
> The patch is against Samba version 4.6.7, currently used by Zentyal
> 5.1 
> and Ubuntu artful. I know it's not the latest version; I can reapply
> it 
> on a more recent version if needed, but you're probably better
> equipped 
> than me to do that.
> Hope you find it useful.

Since Samba 4.9 we have a --json output, and we are moving to JSON as
our text-based interchange format.  While not matching the windows tool
you mention, it should help your use case.

That isn't to say we absolutely couldn't have a --csv option (say if
there are common scripts around the windows tool), but I would be more
cautious as it it isn't as structured.  It would also need (reliable!)
tests added.

If you still wanted to go forward with it then rebasing it on master
and writing those tests would be the first step. 


Andrew Bartlett

Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

More information about the samba-technical mailing list