mirror of
https://github.com/hamburghammer/gsave.git
synced 2025-01-09 16:27:41 +01:00
4eafabc465
Add json serialization information Add one complete data example to the db init script
27 lines
682 B
Go
27 lines
682 B
Go
package db
|
|
|
|
import "time"
|
|
|
|
// Stats struct represents a stats datapoint information of a host to be stored.
|
|
type Stats struct {
|
|
Hostname string `json:"hostname"`
|
|
Date time.Time `json:"date"`
|
|
CPU float64 `json:"cpu"`
|
|
Processes []Process `json:"processes"`
|
|
Disk Memory
|
|
Mem Memory
|
|
}
|
|
|
|
// Process is the representation of a UNIX process with some of its information.
|
|
type Process struct {
|
|
Name string `json:"name"`
|
|
Pid int `json:"pid"`
|
|
CPU float64 `json:"cpu"`
|
|
}
|
|
|
|
// Memory represents the usage of disk or RAM space.
|
|
// It shows the used and the total available space.
|
|
type Memory struct {
|
|
Used int `json:"used"`
|
|
Total int `json:"total"`
|
|
}
|