diff --git a/collectors/cpustatMetric.go b/collectors/cpustatMetric.go index 9e44fa7..64b5842 100644 --- a/collectors/cpustatMetric.go +++ b/collectors/cpustatMetric.go @@ -3,11 +3,12 @@ package collectors import ( "encoding/json" "fmt" - lp "github.com/influxdata/line-protocol" "io/ioutil" "strconv" "strings" "time" + + lp "github.com/influxdata/line-protocol" ) const CPUSTATFILE = `/proc/stat` @@ -88,5 +89,4 @@ func (m *CpustatCollector) Read(interval time.Duration, out *[]lp.MutableMetric) func (m *CpustatCollector) Close() { m.init = false - return } diff --git a/collectors/customCmdMetric.go b/collectors/customCmdMetric.go index 547bb87..bbafc2d 100644 --- a/collectors/customCmdMetric.go +++ b/collectors/customCmdMetric.go @@ -3,12 +3,13 @@ package collectors import ( "encoding/json" "errors" - lp "github.com/influxdata/line-protocol" "io/ioutil" "log" "os/exec" "strings" "time" + + lp "github.com/influxdata/line-protocol" ) const CUSTOMCMDPATH = `/home/unrz139/Work/cc-metric-collector/collectors/custom` @@ -126,5 +127,4 @@ func (m *CustomCmdCollector) Read(interval time.Duration, out *[]lp.MutableMetri func (m *CustomCmdCollector) Close() { m.init = false - return } diff --git a/collectors/diskstatMetric.go b/collectors/diskstatMetric.go index 5080ca2..4cbd3c6 100644 --- a/collectors/diskstatMetric.go +++ b/collectors/diskstatMetric.go @@ -1,8 +1,10 @@ package collectors import ( - lp "github.com/influxdata/line-protocol" "io/ioutil" + + lp "github.com/influxdata/line-protocol" + // "log" "encoding/json" "errors" @@ -107,10 +109,8 @@ func (m *DiskstatCollector) Read(interval time.Duration, out *[]lp.MutableMetric } } } - return } func (m *DiskstatCollector) Close() { m.init = false - return } diff --git a/collectors/gpfs.go b/collectors/gpfsMetric.go similarity index 98% rename from collectors/gpfs.go rename to collectors/gpfsMetric.go index db8a0d0..fbf3a63 100644 --- a/collectors/gpfs.go +++ b/collectors/gpfsMetric.go @@ -17,13 +17,11 @@ import ( lp "github.com/influxdata/line-protocol" ) -type GpfsCollectorConfig struct { - Mmpmon string `json:"mmpmon"` -} - type GpfsCollector struct { MetricCollector - config GpfsCollectorConfig + config struct { + Mmpmon string `json:"mmpmon"` + } } func (m *GpfsCollector) Init(config []byte) error { @@ -297,5 +295,4 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { func (m *GpfsCollector) Close() { m.init = false - return } diff --git a/collectors/infinibandMetric.go b/collectors/infinibandMetric.go index a9552f7..6e14251 100644 --- a/collectors/infinibandMetric.go +++ b/collectors/infinibandMetric.go @@ -2,10 +2,12 @@ package collectors import ( "fmt" - lp "github.com/influxdata/line-protocol" "io/ioutil" "log" "os/exec" + + lp "github.com/influxdata/line-protocol" + // "os" "encoding/json" "errors" @@ -278,5 +280,4 @@ func (m *InfinibandCollector) Read(interval time.Duration, out *[]lp.MutableMetr func (m *InfinibandCollector) Close() { m.init = false - return } diff --git a/collectors/ipmiMetric.go b/collectors/ipmiMetric.go index d28a134..3179148 100644 --- a/collectors/ipmiMetric.go +++ b/collectors/ipmiMetric.go @@ -3,13 +3,14 @@ package collectors import ( "encoding/json" "errors" - lp "github.com/influxdata/line-protocol" "log" "os" "os/exec" "strconv" "strings" "time" + + lp "github.com/influxdata/line-protocol" ) const IPMITOOL_PATH = `/usr/bin/ipmitool` @@ -133,5 +134,4 @@ func (m *IpmiCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { func (m *IpmiCollector) Close() { m.init = false - return } diff --git a/collectors/likwidMetric.go b/collectors/likwidMetric.go index 34e2364..454a593 100644 --- a/collectors/likwidMetric.go +++ b/collectors/likwidMetric.go @@ -12,8 +12,6 @@ import ( "encoding/json" "errors" "fmt" - lp "github.com/influxdata/line-protocol" - "gopkg.in/Knetic/govaluate.v2" "io/ioutil" "log" "math" @@ -22,6 +20,9 @@ import ( "strings" "time" "unsafe" + + lp "github.com/influxdata/line-protocol" + "gopkg.in/Knetic/govaluate.v2" ) type LikwidCollectorMetricConfig struct { @@ -303,5 +304,4 @@ func (m *LikwidCollector) Close() { C.perfmon_finalize() C.topology_finalize() } - return } diff --git a/collectors/loadavgMetric.go b/collectors/loadavgMetric.go index 21cf350..1ecaea5 100644 --- a/collectors/loadavgMetric.go +++ b/collectors/loadavgMetric.go @@ -2,11 +2,12 @@ package collectors import ( "encoding/json" - lp "github.com/influxdata/line-protocol" "io/ioutil" "strconv" "strings" "time" + + lp "github.com/influxdata/line-protocol" ) const LOADAVGFILE = `/proc/loadavg` @@ -76,5 +77,4 @@ func (m *LoadavgCollector) Read(interval time.Duration, out *[]lp.MutableMetric) func (m *LoadavgCollector) Close() { m.init = false - return } diff --git a/collectors/lustreMetric.go b/collectors/lustreMetric.go index e7bb7a6..d77ac09 100644 --- a/collectors/lustreMetric.go +++ b/collectors/lustreMetric.go @@ -3,12 +3,13 @@ package collectors import ( "encoding/json" "errors" - lp "github.com/influxdata/line-protocol" "io/ioutil" "log" "strconv" "strings" "time" + + lp "github.com/influxdata/line-protocol" ) const LUSTREFILE = `/proc/fs/lustre/llite/lnec-XXXXXX/stats` @@ -102,5 +103,4 @@ func (m *LustreCollector) Read(interval time.Duration, out *[]lp.MutableMetric) func (m *LustreCollector) Close() { m.init = false - return } diff --git a/collectors/memstatMetric.go b/collectors/memstatMetric.go index 91987bb..17db13e 100644 --- a/collectors/memstatMetric.go +++ b/collectors/memstatMetric.go @@ -4,12 +4,13 @@ import ( "encoding/json" "errors" "fmt" - lp "github.com/influxdata/line-protocol" "io/ioutil" "log" "strconv" "strings" "time" + + lp "github.com/influxdata/line-protocol" ) const MEMSTATFILE = `/proc/meminfo` @@ -125,5 +126,4 @@ func (m *MemstatCollector) Read(interval time.Duration, out *[]lp.MutableMetric) func (m *MemstatCollector) Close() { m.init = false - return } diff --git a/collectors/netstatMetric.go b/collectors/netstatMetric.go index 659b89f..a273de1 100644 --- a/collectors/netstatMetric.go +++ b/collectors/netstatMetric.go @@ -2,12 +2,13 @@ package collectors import ( "encoding/json" - lp "github.com/influxdata/line-protocol" "io/ioutil" "log" "strconv" "strings" "time" + + lp "github.com/influxdata/line-protocol" ) const NETSTATFILE = `/proc/net/dev` @@ -84,5 +85,4 @@ func (m *NetstatCollector) Read(interval time.Duration, out *[]lp.MutableMetric) func (m *NetstatCollector) Close() { m.init = false - return } diff --git a/collectors/nvidiaMetric.go b/collectors/nvidiaMetric.go index bd63e2c..31118c2 100644 --- a/collectors/nvidiaMetric.go +++ b/collectors/nvidiaMetric.go @@ -4,10 +4,11 @@ import ( "encoding/json" "errors" "fmt" - "github.com/NVIDIA/go-nvml/pkg/nvml" - lp "github.com/influxdata/line-protocol" "log" "time" + + "github.com/NVIDIA/go-nvml/pkg/nvml" + lp "github.com/influxdata/line-protocol" ) type NvidiaCollectorConfig struct { @@ -267,5 +268,4 @@ func (m *NvidiaCollector) Close() { nvml.Shutdown() m.init = false } - return } diff --git a/collectors/tempMetric.go b/collectors/tempMetric.go index 3665025..b074d78 100644 --- a/collectors/tempMetric.go +++ b/collectors/tempMetric.go @@ -3,13 +3,14 @@ package collectors import ( "encoding/json" "fmt" - lp "github.com/influxdata/line-protocol" "io/ioutil" "os" "path/filepath" "strconv" "strings" "time" + + lp "github.com/influxdata/line-protocol" ) const HWMON_PATH = `/sys/class/hwmon` @@ -105,5 +106,4 @@ func (m *TempCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { func (m *TempCollector) Close() { m.init = false - return } diff --git a/collectors/topprocsMetric.go b/collectors/topprocsMetric.go index a1bf989..e1b31ee 100644 --- a/collectors/topprocsMetric.go +++ b/collectors/topprocsMetric.go @@ -4,11 +4,12 @@ import ( "encoding/json" "errors" "fmt" - lp "github.com/influxdata/line-protocol" "log" "os/exec" "strings" "time" + + lp "github.com/influxdata/line-protocol" ) const MAX_NUM_PROCS = 10 @@ -74,5 +75,4 @@ func (m *TopProcsCollector) Read(interval time.Duration, out *[]lp.MutableMetric func (m *TopProcsCollector) Close() { m.init = false - return } diff --git a/sinks/stdoutSink.go b/sinks/stdoutSink.go index 34561e0..8016fcb 100644 --- a/sinks/stdoutSink.go +++ b/sinks/stdoutSink.go @@ -59,6 +59,4 @@ func (s *StdoutSink) Flush() error { return nil } -func (s *StdoutSink) Close() { - return -} +func (s *StdoutSink) Close() {}