-
Notifications
You must be signed in to change notification settings - Fork 183
/
load.go
43 lines (33 loc) · 1.22 KB
/
load.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
// +build linux
package load
//go:generate collectd-template-to-go load.tmpl
import (
"github.com/signalfx/signalfx-agent/internal/core/config"
"github.com/signalfx/signalfx-agent/internal/monitors"
"github.com/signalfx/signalfx-agent/internal/monitors/collectd"
)
// MONITOR(collectd/load): Monitors process load on the host using the collectd
// [Load plugin](https://collectd.org/wiki/index.php/Plugin:Load).
// GAUGE(load.longterm): Average CPU load per core over the last 15 minutes
// GAUGE(load.midterm): Average CPU load per core over the last five minutes
// GAUGE(load.shortterm): Average CPU load per core over the last one minute
const monitorType = "collectd/load"
func init() {
monitors.Register(monitorType, func() interface{} {
return &Monitor{
MonitorCore: *collectd.NewMonitorCore(CollectdTemplate),
}
}, &Config{})
}
// Config is the monitor-specific config with the generic config embedded
type Config struct {
config.MonitorConfig `singleInstance:"true"`
}
// Monitor is the main type that represents the monitor
type Monitor struct {
collectd.MonitorCore
}
// Configure configures and runs the plugin in collectd
func (m *Monitor) Configure(conf *Config) error {
return m.SetConfigurationAndRun(conf)
}