119 lines
3.5 KiB
Go
119 lines
3.5 KiB
Go
package sysinfo
|
||
|
||
// JSONSchema – draft-2020-12. Updated to include “packages” and a
|
||
// “distro” field inside the system block so multiple Linux distros are
|
||
// representable even though only Ubuntu is collected today.
|
||
const JSONSchema = `
|
||
{
|
||
"$schema":"https://json-schema.org/draft/2020-12/schema",
|
||
"title":"Sysinfo snapshot",
|
||
"type":"object",
|
||
"required":["snapshot_time","system"],
|
||
"properties":{
|
||
"snapshot_time":{"type":"string","format":"date-time"},
|
||
"system":{"$ref":"#/$defs/system"},
|
||
"sensors":{"$ref":"#/$defs/sensors"},
|
||
"blockdevs":{
|
||
"type":"object",
|
||
"patternProperties":{"^[A-Za-z0-9._-]+$":{"$ref":"#/$defs/block"}},
|
||
"additionalProperties":false
|
||
},
|
||
"network":{
|
||
"type":"object",
|
||
"patternProperties":{"^[0-9a-f]{12}$":{"$ref":"#/$defs/iface"}},
|
||
"additionalProperties":false
|
||
},
|
||
"zfs":{
|
||
"type":"object",
|
||
"patternProperties":{"^[A-Za-z0-9._-]+$":{"$ref":"#/$defs/zpool"}},
|
||
"additionalProperties":false
|
||
},
|
||
"packages":{"$ref":"#/$defs/packages"}
|
||
},
|
||
"$defs":{
|
||
"system":{
|
||
"type":"object",
|
||
"required":["timestamp","id","distro","uname"],
|
||
"properties":{
|
||
"timestamp":{"type":"string","format":"date-time"},
|
||
"id":{"type":"string"},
|
||
"distro":{"type":"string"},
|
||
"lsb_release":{"type":"string"},
|
||
"uname":{"type":"string"},
|
||
"cpuinfo":{"type":"string"},
|
||
"meminfo":{"type":"string"},
|
||
"dmidecode":{"type":"string"}
|
||
},
|
||
"additionalProperties":false
|
||
},
|
||
"sensors":{
|
||
"type":"object",
|
||
"properties":{"output":{"type":"string"}},
|
||
"required":["output"],
|
||
"additionalProperties":false
|
||
},
|
||
"block":{
|
||
"type":"object",
|
||
"required":["timestamp","smartctl","sfdisk","blkid","lsblk",
|
||
"partitions"],
|
||
"properties":{
|
||
"timestamp":{"type":"string","format":"date-time"},
|
||
"smartctl":{"type":"string"},
|
||
"luksDump":{"type":"string"},
|
||
"sfdisk":{"type":"object"},
|
||
"blkid":{"type":"string"},
|
||
"lsblk":{"type":"object"},
|
||
"partitions":{
|
||
"type":"object",
|
||
"patternProperties":{
|
||
"^[A-Fa-f0-9-]+$":{"$ref":"#/$defs/partition"}
|
||
},
|
||
"additionalProperties":false
|
||
}
|
||
},
|
||
"additionalProperties":false
|
||
},
|
||
"partition":{
|
||
"type":"object",
|
||
"required":["blkid","lsblk"],
|
||
"properties":{
|
||
"blkid":{"type":"string"},
|
||
"lsblk":{"type":"object"}
|
||
},
|
||
"additionalProperties":false
|
||
},
|
||
"iface":{
|
||
"type":"object",
|
||
"required":["iface","ip_addr","link","statistics","timestamp"],
|
||
"properties":{
|
||
"iface":{"type":"string"},
|
||
"ip_addr":{"type":"object"},
|
||
"link":{"type":"string"},
|
||
"ethtool":{"type":"string"},
|
||
"statistics":{"type":"object"},
|
||
"ipinfo":{"type":"object"},
|
||
"timestamp":{"type":"string","format":"date-time"}
|
||
},
|
||
"additionalProperties":false
|
||
},
|
||
"zpool":{
|
||
"type":"object",
|
||
"required":["timestamp","status","get","zfs_list"],
|
||
"properties":{
|
||
"timestamp":{"type":"string","format":"date-time"},
|
||
"status":{"type":"string"},
|
||
"get":{"type":"string"},
|
||
"zfs_list":{"type":"string"}
|
||
},
|
||
"additionalProperties":false
|
||
},
|
||
"packages":{
|
||
"type":"object",
|
||
"properties":{"dpkg":{"type":"string"}},
|
||
"required":["dpkg"],
|
||
"additionalProperties":false
|
||
}
|
||
}
|
||
}
|
||
`
|