smbstatus json/xml output with libxo

Andrew Walker awalker at ixsystems.com
Mon Apr 15 16:55:47 UTC 2019


This weekend I had a small amount of free time and decided to add json/xml
support to smbstatus. It's still very much a WIP, but thought it might be
fun to share.

JSON:
root at S3:/usr/ports/net/samba410 # smbstatus --libxo json
{"processes": {"Samba_version":"4.10.2", "session":
[{"PID":"37213","Username":"awalker     ","Groupname":"awalker
","Machine":"10.231.4.90 (ipv4:10.231.4.90:49554
)","Protocol":"SMB3_02","Encryption":"-","Signing":"-"}]}
, "shares": {"connection":
[{"Service":"share","pid":"37213","Machine":"10.231.4.90","Connected
at":"Mon Apr 15 09:36:10 2019 PDT","Encryption":"-","Signing":"-"}]}
, "locks": {"sharemode":
[{"Pid":"37213","User(ID)":1001,"DenyMode":"DENY_NONE","Access":"100081","RW":"RDONLY","Oplock:":"NONE","Path:":"/mnt/tank/samba","Name:":".","Time:":"Mon
Apr 15 09:36:12 2019\n"}], "brl": []}
}

XML:
root at S3:/usr/ports/net/samba410 # smbstatus --libxo xml
<processes><Samba_version>4.10.2</Samba_version><session><PID>37213</PID><Username>awalker
</Username><Groupname>awalker     </Groupname><Machine>10.231.4.90 (ipv4:
10.231.4.90:49554)</Machine><Protocol>SMB3_02</Protocol><Encryption>-</Encryption><Signing>-</Signing></session></processes><shares><connection><Service>share</Service><pid>37213</pid><Machine>10.231.4.90</Machine><Connected
at>Mon Apr 15 09:36:10 2019 PDT</Connected
at><Encryption>-</Encryption><Signing>-</Signing></connection></shares><locks><sharemode><Pid>37213</Pid><User(ID)>1001</User(ID)><DenyMode>DENY_NONE</DenyMode><Access>100081</Access><RW>RDONLY</RW><Oplock:>NONE</Oplock:><Path:>/mnt/tank/samba</Path:><Name:>.</Name:><Time:>Mon
Apr 15 09:36:12 2019

This is not exactly suitable for general consumption. If this (libxo
support) is something that you all think would be useful to have in samba
in general, I'm happy to work on it as I have free time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smbstatuslibxo.patch
Type: text/x-patch
Size: 11349 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20190415/307cbab9/smbstatuslibxo.bin>


More information about the samba-technical mailing list