You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.9 KiB
Go
76 lines
1.9 KiB
Go
package main
|
|
|
|
import (
|
|
"sync"
|
|
"time"
|
|
)
|
|
|
|
type Test struct {
|
|
sync.Mutex
|
|
ticker *time.Ticker
|
|
Status string
|
|
Done chan bool
|
|
Rate int
|
|
Name string
|
|
Result []Metric
|
|
Timeout time.Duration
|
|
}
|
|
|
|
type LoadMetric struct {
|
|
Load1m float64 `json:"load1m"`
|
|
Load5m float64 `json:"load5m"`
|
|
Load15m float64 `json:"load15m"`
|
|
}
|
|
|
|
type MemMetric struct {
|
|
FreeMem uint64 `json:"freemem"`
|
|
TotalMem uint64 `json:"totalmem"`
|
|
UsedMem uint64 `json:"usedmem"`
|
|
BuffersMem uint64 `json:"buffersmem"`
|
|
CachedMem uint64 `json:"cachedmem"`
|
|
AvailableMem uint64 `json:"availablemem"`
|
|
ActiveMem uint64 `json:"activemem"`
|
|
InactiveMem uint64 `json:"inactivemem"`
|
|
SwapTotal uint64 `json:"swaptotal"`
|
|
SwapUsed uint64 `json:"swapused"`
|
|
SwapCached uint64 `json:"swapcached"`
|
|
SwapFree uint64 `json:"swapfree"`
|
|
}
|
|
|
|
type CpuMetric struct {
|
|
User uint64 `json:"user"`
|
|
Nice uint64 `json:"nice"`
|
|
System uint64 `json:"system"`
|
|
Idle uint64 `json:"idle"`
|
|
Iowait uint64 `json:"iowait"`
|
|
Irq uint64 `json:"irq"`
|
|
Softirq uint64 `json:"softirq"`
|
|
Steal uint64 `json:"steal"`
|
|
Guest uint64 `json:"guest"`
|
|
GuestNice uint64 `json:"guestnice"`
|
|
Total uint64 `json:"total"`
|
|
CPUCount int `json:"cpucount"`
|
|
StatCount int `json:"statcount"`
|
|
}
|
|
|
|
type DiskMetric struct {
|
|
Name string `json:"name"`
|
|
WritesCompleted uint64 `json:"writes_completed"`
|
|
ReadsCompleted uint64 `json:"reads_completed"`
|
|
}
|
|
|
|
type NetworkMetric struct {
|
|
Name string `json:"name"`
|
|
RxBytes uint64 `json:"rx_bytes"`
|
|
TxBytes uint64 `json:"tx_bytes"`
|
|
}
|
|
|
|
type Metric struct {
|
|
LoadMetrics LoadMetric `json:"load_metrics"`
|
|
Timestamp time.Time `json:"timestamp"`
|
|
MemMetrics MemMetric `json:"mem_metrics"`
|
|
CPUMetrics CpuMetric `json:"cpu_metrics"`
|
|
DiskMetrics []DiskMetric `json:"disk_metrics"`
|
|
NetworkMetrics []NetworkMetric `json:"network_metrics"`
|
|
}
|