code refactor: extract Interval struct so every plugin no need to implement function GetInterval
This commit is contained in:
parent
dcb909f971
commit
6e982af96c
|
@ -0,0 +1,9 @@
|
||||||
|
package config
|
||||||
|
|
||||||
|
type Interval struct {
|
||||||
|
Interval Duration `toml:"interval"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i Interval) GetInterval() Duration {
|
||||||
|
return i.Interval
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ type CPUStats struct {
|
||||||
ps system.PS
|
ps system.PS
|
||||||
lastStats map[string]cpuUtil.TimesStat
|
lastStats map[string]cpuUtil.TimesStat
|
||||||
|
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
CollectPerCPU bool `toml:"collect_per_cpu"`
|
CollectPerCPU bool `toml:"collect_per_cpu"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,10 +34,6 @@ func (s *CPUStats) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CPUStats) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
// overwrite func
|
// overwrite func
|
||||||
func (c *CPUStats) Init() error {
|
func (c *CPUStats) Init() error {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -16,7 +16,7 @@ const inputName = "disk"
|
||||||
type DiskStats struct {
|
type DiskStats struct {
|
||||||
ps system.PS
|
ps system.PS
|
||||||
|
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
MountPoints []string `toml:"mount_points"`
|
MountPoints []string `toml:"mount_points"`
|
||||||
IgnoreFS []string `toml:"ignore_fs"`
|
IgnoreFS []string `toml:"ignore_fs"`
|
||||||
IgnoreMountPoints []string `toml:"ignore_mount_points"`
|
IgnoreMountPoints []string `toml:"ignore_mount_points"`
|
||||||
|
@ -35,10 +35,6 @@ func (s *DiskStats) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DiskStats) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DiskStats) Init() error {
|
func (s *DiskStats) Init() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ const inputName = "diskio"
|
||||||
type DiskIO struct {
|
type DiskIO struct {
|
||||||
ps system.PS
|
ps system.PS
|
||||||
|
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Devices []string `toml:"devices"`
|
Devices []string `toml:"devices"`
|
||||||
deviceFilter filter.Filter
|
deviceFilter filter.Filter
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,6 @@ func (d *DiskIO) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DiskIO) GetInterval() config.Duration {
|
|
||||||
return d.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DiskIO) Drop() {}
|
func (d *DiskIO) Drop() {}
|
||||||
|
|
||||||
func (d *DiskIO) Init() error {
|
func (d *DiskIO) Init() error {
|
||||||
|
|
|
@ -36,7 +36,7 @@ type ExecInstance struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Exec struct {
|
type Exec struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []ExecInstance `toml:"instances"`
|
Instances []ExecInstance `toml:"instances"`
|
||||||
Counter uint64
|
Counter uint64
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,6 @@ func (e *Exec) Prefix() string {
|
||||||
|
|
||||||
func (e *Exec) Drop() {}
|
func (e *Exec) Drop() {}
|
||||||
|
|
||||||
func (e *Exec) GetInterval() config.Duration {
|
|
||||||
return e.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *Exec) Init() error {
|
func (e *Exec) Init() error {
|
||||||
if len(e.Instances) == 0 {
|
if len(e.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
|
|
@ -128,7 +128,7 @@ func (ins *Instance) createHTTPClient() (*http.Client, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type HTTPResponse struct {
|
type HTTPResponse struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []*Instance `toml:"instances"`
|
Instances []*Instance `toml:"instances"`
|
||||||
Counter uint64
|
Counter uint64
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
|
@ -144,10 +144,6 @@ func (h *HTTPResponse) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HTTPResponse) GetInterval() config.Duration {
|
|
||||||
return h.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HTTPResponse) Init() error {
|
func (h *HTTPResponse) Init() error {
|
||||||
if len(h.Instances) == 0 {
|
if len(h.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
|
|
@ -28,10 +28,10 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
type KernelStats struct {
|
type KernelStats struct {
|
||||||
|
config.Interval
|
||||||
|
|
||||||
statFile string
|
statFile string
|
||||||
entropyStatFile string
|
entropyStatFile string
|
||||||
|
|
||||||
Interval config.Duration `toml:"interval"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -47,10 +47,6 @@ func (s *KernelStats) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *KernelStats) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *KernelStats) Init() error {
|
func (s *KernelStats) Init() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
const inputName = "kernelvmstat"
|
const inputName = "kernelvmstat"
|
||||||
|
|
||||||
type KernelVmstat struct {
|
type KernelVmstat struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
WhiteList map[string]int `toml:"white_list"`
|
WhiteList map[string]int `toml:"white_list"`
|
||||||
|
|
||||||
statFile string
|
statFile string
|
||||||
|
@ -36,10 +36,6 @@ func (s *KernelVmstat) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *KernelVmstat) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *KernelVmstat) Init() error {
|
func (s *KernelVmstat) Init() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
const inputName = "linuxsysctlfs"
|
const inputName = "linuxsysctlfs"
|
||||||
|
|
||||||
type SysctlFS struct {
|
type SysctlFS struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
|
|
||||||
path string
|
path string
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,6 @@ func (s *SysctlFS) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SysctlFS) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SysctlFS) Init() error {
|
func (s *SysctlFS) Init() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ type MemStats struct {
|
||||||
ps system.PS
|
ps system.PS
|
||||||
platform string
|
platform string
|
||||||
|
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
CollectPlatformFields bool `toml:"collect_platform_fields"`
|
CollectPlatformFields bool `toml:"collect_platform_fields"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,10 +33,6 @@ func (s *MemStats) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MemStats) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *MemStats) Drop() {}
|
func (s *MemStats) Drop() {}
|
||||||
|
|
||||||
func (s *MemStats) Init() error {
|
func (s *MemStats) Init() error {
|
||||||
|
|
|
@ -152,7 +152,7 @@ func (ins *Instance) InitValidMetrics() {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MySQL struct {
|
type MySQL struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []*Instance `toml:"instances"`
|
Instances []*Instance `toml:"instances"`
|
||||||
|
|
||||||
Counter uint64
|
Counter uint64
|
||||||
|
@ -169,10 +169,6 @@ func (m *MySQL) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MySQL) GetInterval() config.Duration {
|
|
||||||
return m.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *MySQL) Init() error {
|
func (m *MySQL) Init() error {
|
||||||
if len(m.Instances) == 0 {
|
if len(m.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
|
|
@ -17,7 +17,7 @@ const inputName = "net"
|
||||||
type NetIOStats struct {
|
type NetIOStats struct {
|
||||||
ps system.PS
|
ps system.PS
|
||||||
|
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
CollectProtocolStats bool `toml:"collect_protocol_stats"`
|
CollectProtocolStats bool `toml:"collect_protocol_stats"`
|
||||||
Interfaces []string `toml:"interfaces"`
|
Interfaces []string `toml:"interfaces"`
|
||||||
|
|
||||||
|
@ -37,10 +37,6 @@ func (s *NetIOStats) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *NetIOStats) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *NetIOStats) Drop() {}
|
func (s *NetIOStats) Drop() {}
|
||||||
|
|
||||||
func (s *NetIOStats) Init() error {
|
func (s *NetIOStats) Init() error {
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (ins *Instance) Init() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type NetResponse struct {
|
type NetResponse struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []*Instance `toml:"instances"`
|
Instances []*Instance `toml:"instances"`
|
||||||
Counter uint64
|
Counter uint64
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
|
@ -101,10 +101,6 @@ func (n *NetResponse) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NetResponse) GetInterval() config.Duration {
|
|
||||||
return n.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n *NetResponse) Init() error {
|
func (n *NetResponse) Init() error {
|
||||||
if len(n.Instances) == 0 {
|
if len(n.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
|
|
@ -14,8 +14,7 @@ const inputName = "netstat"
|
||||||
|
|
||||||
type NetStats struct {
|
type NetStats struct {
|
||||||
ps system.PS
|
ps system.PS
|
||||||
|
config.Interval
|
||||||
Interval config.Duration `toml:"interval"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -31,10 +30,6 @@ func (s *NetStats) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *NetStats) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *NetStats) Drop() {}
|
func (s *NetStats) Drop() {}
|
||||||
|
|
||||||
func (s *NetStats) Init() error {
|
func (s *NetStats) Init() error {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
const inputName = "ntp"
|
const inputName = "ntp"
|
||||||
|
|
||||||
type NTPStat struct {
|
type NTPStat struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
NTPServers []string `toml:"ntp_servers"`
|
NTPServers []string `toml:"ntp_servers"`
|
||||||
server string
|
server string
|
||||||
}
|
}
|
||||||
|
@ -29,10 +29,6 @@ func (n *NTPStat) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NTPStat) GetInterval() config.Duration {
|
|
||||||
return n.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n *NTPStat) Drop() {}
|
func (n *NTPStat) Drop() {}
|
||||||
|
|
||||||
func (n *NTPStat) Init() error {
|
func (n *NTPStat) Init() error {
|
||||||
|
|
|
@ -44,7 +44,7 @@ type MetricConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Oracle struct {
|
type Oracle struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []OrclInstance `toml:"instances"`
|
Instances []OrclInstance `toml:"instances"`
|
||||||
Metrics []MetricConfig `toml:"metrics"`
|
Metrics []MetricConfig `toml:"metrics"`
|
||||||
|
|
||||||
|
@ -63,10 +63,6 @@ func (o *Oracle) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Oracle) GetInterval() config.Duration {
|
|
||||||
return o.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *Oracle) Init() error {
|
func (o *Oracle) Init() error {
|
||||||
if len(o.Instances) == 0 {
|
if len(o.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
|
|
@ -22,7 +22,7 @@ const (
|
||||||
defaultPingDataBytesSize = 56
|
defaultPingDataBytesSize = 56
|
||||||
)
|
)
|
||||||
|
|
||||||
type PingInstance struct {
|
type Instance struct {
|
||||||
Targets []string `toml:"targets"`
|
Targets []string `toml:"targets"`
|
||||||
Labels map[string]string `toml:"labels"`
|
Labels map[string]string `toml:"labels"`
|
||||||
IntervalTimes int64 `toml:"interval_times"`
|
IntervalTimes int64 `toml:"interval_times"`
|
||||||
|
@ -38,7 +38,7 @@ type PingInstance struct {
|
||||||
sourceAddress string
|
sourceAddress string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ins *PingInstance) Init() error {
|
func (ins *Instance) Init() error {
|
||||||
if ins.Count < 1 {
|
if ins.Count < 1 {
|
||||||
ins.Count = 1
|
ins.Count = 1
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,8 @@ func (ins *PingInstance) Init() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Ping struct {
|
type Ping struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []*PingInstance `toml:"instances"`
|
Instances []*Instance `toml:"instances"`
|
||||||
Counter uint64
|
Counter uint64
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
}
|
}
|
||||||
|
@ -93,10 +93,6 @@ func (p *Ping) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Ping) GetInterval() config.Duration {
|
|
||||||
return p.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Ping) Init() error {
|
func (p *Ping) Init() error {
|
||||||
if len(p.Instances) == 0 {
|
if len(p.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
@ -123,7 +119,7 @@ func (p *Ping) Gather(slist *list.SafeList) {
|
||||||
p.wg.Wait()
|
p.wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Ping) gatherOnce(slist *list.SafeList, ins *PingInstance) {
|
func (p *Ping) gatherOnce(slist *list.SafeList, ins *Instance) {
|
||||||
defer p.wg.Done()
|
defer p.wg.Done()
|
||||||
|
|
||||||
if ins.IntervalTimes > 0 {
|
if ins.IntervalTimes > 0 {
|
||||||
|
@ -150,7 +146,7 @@ func (p *Ping) gatherOnce(slist *list.SafeList, ins *PingInstance) {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ins *PingInstance) gather(slist *list.SafeList, target string) {
|
func (ins *Instance) gather(slist *list.SafeList, target string) {
|
||||||
if config.Config.DebugMode {
|
if config.Config.DebugMode {
|
||||||
log.Println("D! ping...", target)
|
log.Println("D! ping...", target)
|
||||||
}
|
}
|
||||||
|
@ -206,7 +202,7 @@ type pingStats struct {
|
||||||
ttl int
|
ttl int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ins *PingInstance) ping(destination string) (*pingStats, error) {
|
func (ins *Instance) ping(destination string) (*pingStats, error) {
|
||||||
ps := &pingStats{}
|
ps := &pingStats{}
|
||||||
|
|
||||||
pinger, err := ping.NewPinger(destination)
|
pinger, err := ping.NewPinger(destination)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
const inputName = "processes"
|
const inputName = "processes"
|
||||||
|
|
||||||
type Processes struct {
|
type Processes struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
ForcePS bool `toml:"force_ps"`
|
ForcePS bool `toml:"force_ps"`
|
||||||
ForceProc bool `toml:"force_proc"`
|
ForceProc bool `toml:"force_proc"`
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,6 @@ func (p *Processes) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Processes) GetInterval() config.Duration {
|
|
||||||
return p.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Processes) Drop() {}
|
func (p *Processes) Drop() {}
|
||||||
|
|
||||||
func (p *Processes) Init() error {
|
func (p *Processes) Init() error {
|
||||||
|
|
|
@ -60,7 +60,7 @@ func (ins *Instance) Init() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Procstat struct {
|
type Procstat struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []*Instance `toml:"instances"`
|
Instances []*Instance `toml:"instances"`
|
||||||
Counter uint64
|
Counter uint64
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
|
@ -76,10 +76,6 @@ func (s *Procstat) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Procstat) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Procstat) Init() error {
|
func (s *Procstat) Init() error {
|
||||||
if len(s.Instances) == 0 {
|
if len(s.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
|
|
@ -84,7 +84,7 @@ func (ins *Instance) createHTTPClient() (*http.Client, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Prometheus struct {
|
type Prometheus struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []*Instance `toml:"instances"`
|
Instances []*Instance `toml:"instances"`
|
||||||
|
|
||||||
Counter uint64
|
Counter uint64
|
||||||
|
@ -101,10 +101,6 @@ func (p *Prometheus) Prefix() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Prometheus) GetInterval() config.Duration {
|
|
||||||
return p.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Prometheus) Init() error {
|
func (p *Prometheus) Init() error {
|
||||||
if len(p.Instances) == 0 {
|
if len(p.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
|
|
@ -64,7 +64,7 @@ func (ins *Instance) Init() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Redis struct {
|
type Redis struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []*Instance `toml:"instances"`
|
Instances []*Instance `toml:"instances"`
|
||||||
|
|
||||||
Counter uint64
|
Counter uint64
|
||||||
|
@ -81,10 +81,6 @@ func (r *Redis) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Redis) GetInterval() config.Duration {
|
|
||||||
return r.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Redis) Init() error {
|
func (r *Redis) Init() error {
|
||||||
if len(r.Instances) == 0 {
|
if len(r.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
const inputName = "system"
|
const inputName = "system"
|
||||||
|
|
||||||
type SystemStats struct {
|
type SystemStats struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
CollectUserNumber bool `toml:"collect_user_number"`
|
CollectUserNumber bool `toml:"collect_user_number"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,10 +30,6 @@ func (s *SystemStats) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SystemStats) GetInterval() config.Duration {
|
|
||||||
return s.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SystemStats) Init() error {
|
func (s *SystemStats) Init() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ func (ins *Instance) createHTTPClient() (*http.Client, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Tomcat struct {
|
type Tomcat struct {
|
||||||
Interval config.Duration `toml:"interval"`
|
config.Interval
|
||||||
Instances []*Instance `toml:"instances"`
|
Instances []*Instance `toml:"instances"`
|
||||||
|
|
||||||
Counter uint64
|
Counter uint64
|
||||||
|
@ -150,10 +150,6 @@ func (t *Tomcat) Prefix() string {
|
||||||
return inputName
|
return inputName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Tomcat) GetInterval() config.Duration {
|
|
||||||
return t.Interval
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *Tomcat) Init() error {
|
func (t *Tomcat) Init() error {
|
||||||
if len(t.Instances) == 0 {
|
if len(t.Instances) == 0 {
|
||||||
return types.ErrInstancesEmpty
|
return types.ErrInstancesEmpty
|
||||||
|
|
Loading…
Reference in New Issue