summaryrefslogtreecommitdiff
path: root/internal/collector/types.go
blob: 13bcb1f9eeffc5d7e318614686ba12d8c10d27de (plain)
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
package collector

// CPULine is one line of /proc/stat: cpu name + counters (user, nice, system, idle, ...).
type CPULine struct {
	Name                                                                    string
	User, Nice, System, Idle, Iowait, IRQ, SoftIRQ, Steal, Guest, GuestNice int64
}

// Total returns sum of all CPU counters.
func (c CPULine) Total() int64 {
	return c.User + c.Nice + c.System + c.Idle + c.Iowait + c.IRQ + c.SoftIRQ + c.Steal + c.Guest + c.GuestNice
}

// MemLine is one key from /proc/meminfo (e.g. MemTotal, MemFree).
type MemLine struct {
	Key   string
	Value int64
}

// NetLine is one interface line: iface and key=value pairs (b, tb, p, tp, e, te, d, td).
type NetLine struct {
	Iface string
	B     int64 // rx bytes
	Tb    int64 // tx bytes
	P     int64
	Tp    int64
	E     int64
	Te    int64
	D     int64
	Td    int64
}

// LoadAvg is 1/5/15 min load average.
type LoadAvg struct {
	Load1, Load5, Load15 string
}