-
Notifications
You must be signed in to change notification settings - Fork 183
/
memcached.go
49 lines (39 loc) · 1.34 KB
/
memcached.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
// +build linux
package memcached
//go:generate collectd-template-to-go memcached.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/memcached"
// MONITOR(collectd/memcached): Monitors an instance of memcached using the
// [collectd memcached
// plugin](https://collectd.org/wiki/index.php/Plugin:memcached).
//
// See the [integrations
// doc](https://github.com/signalfx/integrations/tree/master/collectd-memcached)
// for more information.
func init() {
monitors.Register(monitorType, func() interface{} {
return &Monitor{
*collectd.NewMonitorCore(CollectdTemplate),
}
}, &Config{})
}
// Config is the monitor-specific config with the generic config embedded
type Config struct {
config.MonitorConfig `yaml:",inline" acceptsEndpoints:"true"`
Host string `yaml:"host" validate:"required"`
Port uint16 `yaml:"port" validate:"required"`
Name string `yaml:"name"`
ReportHost bool `yaml:"reportHost"`
}
// Monitor is the main type that represents the monitor
type Monitor struct {
collectd.MonitorCore
}
// Configure configures and runs the plugin in collectd
func (mm *Monitor) Configure(conf *Config) error {
return mm.SetConfigurationAndRun(conf)
}