Suggestion: /sbin/sysctl: add an option for output in json
Eike Dierks <[email protected]>
| Newsgroups | gmane.os.freebsd.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello to everyone at freebsd
I want to make a suggestion for the /sbin/sysctl command:
I want to introduce a new option, to have the output of sysctl formatted as json.
Most of the sysctl values are Integers or single line strings,
but some are multiline strings.
Take for example:
$ sysctl kern.msgbuf
This makes it hard to parse the output of the sysctl command in a reliable way.
I want to suggest, to enhance the sysctl command
to add an option, to return the output in the json format.
While we are at it, we could alos add some metadata to the json.
I believe, this could be quite easy to do,
But let's talk about that, first.
First of all, this is not posix.
The sysctl command also exists in Linux, Darwin, the other BSDs and SysV
We should talk with them people upfront.
So how should the json output look?
In the naive case that would be:
{ oid: value, ... }
But where to place the metadata and future extensions?
On my first throw I want to suggest:
{
oid: {
value: ...,
type: ...
}
}
This should make the format a lot more easy to extend in the future.
This all relates to snmp and mibs.
I do not want to reinivent that wheel.
Please add to this post,
if there already is an RFC for this.
Hello from sysctl,
~eike