-
Notifications
You must be signed in to change notification settings - Fork 183
/
memory.go
51 lines (37 loc) · 1.45 KB
/
memory.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
44
45
46
47
48
49
50
51
package memory
//go:generate collectd-template-to-go memory.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"
)
const monitorType = "collectd/memory"
// MONITOR(collectd/memory): Sends memory usage stats for the underlying host.
// See https://collectd.org/wiki/index.php/Plugin:Memory
// GAUGE(memory.buffered): Bytes of memory used for buffering I/O
// GAUGE(memory.cached): Bytes of memory used for disk caching
// GAUGE(memory.free): Bytes of memory available for use
// GAUGE(memory.slab_recl): Bytes of memory, used for SLAB-allocation of kernel
// objects, that can be reclaimed.
// GAUGE(memory.slab_unrecl): Bytes of memory, used for SLAB-allocation of
// kernel objects, that can't be reclaimed
// GAUGE(memory.used): Bytes of memory in use by the system.
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)
}