init
This commit is contained in:
33
internal/collectors/collector.go
Normal file
33
internal/collectors/collector.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package collectors
|
||||
|
||||
type StatusInfo struct {
|
||||
CPULoad1 float32
|
||||
CPULoad5 float32
|
||||
CPULoad15 float32
|
||||
Year int
|
||||
Month int
|
||||
Day int
|
||||
Hour int
|
||||
Minute int
|
||||
Second int
|
||||
BatteryPercent int
|
||||
BatteryStatus string
|
||||
}
|
||||
|
||||
func Collect() (*StatusInfo, error) {
|
||||
year, month, day, hour, minute, second := datetime()
|
||||
cpuLoad1, cpuLoad5, cpuLoad15 := cpuLoad()
|
||||
return &StatusInfo{
|
||||
CPULoad1: cpuLoad1,
|
||||
CPULoad5: cpuLoad5,
|
||||
CPULoad15: cpuLoad15,
|
||||
Year: year,
|
||||
Month: int(month),
|
||||
Day: day,
|
||||
Hour: hour,
|
||||
Minute: minute,
|
||||
Second: second,
|
||||
BatteryPercent: 100,
|
||||
BatteryStatus: "Charging",
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user