forked from zcalusic/sysinfo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sysinfo.go
49 lines (41 loc) · 1.29 KB
/
sysinfo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright © 2016 Zlatko Čalušić
//
// Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
// Package sysinfo is a pure Go library providing Linux OS / kernel / hardware system information.
package sysinfo
// SysInfo struct encapsulates all other information structs.
type SysInfo struct {
Meta Meta `json:"sysinfo"`
Node Node `json:"node"`
OS OS `json:"os"`
Kernel Kernel `json:"kernel"`
Product Product `json:"product"`
Board Board `json:"board"`
Chassis Chassis `json:"chassis"`
BIOS BIOS `json:"bios"`
CPU CPU `json:"cpu"`
Memory Memory `json:"memory"`
Storage []StorageDevice `json:"storage,omitempty"`
Network []NetworkDevice `json:"network,omitempty"`
}
// GetSysInfo gathers all available system information.
func (si *SysInfo) GetSysInfo() {
// Meta info
si.getMetaInfo()
// DMI info
si.getProductInfo()
si.getBoardInfo()
si.getChassisInfo()
si.getBIOSInfo()
// SMBIOS info
si.getMemoryInfo()
// Node info
si.getNodeInfo() // depends on BIOS info
// Hardware info
si.getCPUInfo() // depends on Node info
si.getStorageInfo()
si.getNetworkInfo()
// Software info
si.getOSInfo()
si.getKernelInfo()
}