-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.go
59 lines (55 loc) · 1.44 KB
/
Main.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
50
51
52
53
54
55
56
57
58
59
package main
import (
"encoding/json"
"github.com/shirou/gopsutil/host"
)
type Linux struct {
Host *host.InfoStat `json:"host"`
Cpu Cpu `json:"cpu"`
Disk Disk `json:"disk"`
Memory Memory `json:"memory"`
Network Network `json:"network"`
NetInterface []NetInterface `json:"netInterface"`
Process []Process `json:"process"`
Service Service `json:"service"`
Device Device `json:"device"`
Log Log `json:"log"`
FireWall FireWall `json:"firewall"`
DataAmount DataAmount `json:"dataAmount"`
Application Application `json:"application"`
}
func main() {
cpu := GetCpu()
disk := GetDisk()
application := GetAppInfo()
dataamount := GetDataAmount()
device := Getdevice()
firewall := GetFireWall()
host := GetHostInfo()
log := GetLog()
memory := GetMemory()
network := GetNetInfo()
netinterface := GetNetInterface()
process := GetProcess()
service := GetService()
linux := Linux{
Host: host,
Cpu: cpu,
Disk: disk,
Memory: memory,
Network: network,
NetInterface: netinterface,
Process: process,
Service: service,
Device: device,
Log: log,
FireWall: firewall,
DataAmount: dataamount,
Application: application,
}
Linuxes, err := json.Marshal(linux)
if err != nil {
panic(err)
}
WriteFile("Linux.json", Linuxes)
}