Reformat, remove x bit on memavg Collector

This commit is contained in:
Jan Eitzinger 2021-03-19 09:34:12 +01:00
parent 9597798ebc
commit 4519632ef2
2 changed files with 155 additions and 155 deletions

View File

@ -4,14 +4,17 @@ import (
"fmt"
"os"
"os/exec"
//"bytes"
// "context"
"encoding/json"
"path/filepath"
//"sort"
"errors"
"strings"
"time"
"errors"
protocol "github.com/influxdata/line-protocol"
)
@ -81,7 +84,6 @@ func LoadCollectorConfiguration(file string, config *CollectorConfig) error {
return err
}
//////////////////////////////////////////////////////////////////////////////
// Load collector configurations
//////////////////////////////////////////////////////////////////////////////
@ -109,7 +111,6 @@ func GetCollectorFolders(root string, folders *[]string) error {
return err
}
//////////////////////////////////////////////////////////////////////////////
// Setup all collectors
//////////////////////////////////////////////////////////////////////////////
@ -132,7 +133,6 @@ func SetupCollectors(config GlobalConfig) ([]InternalCollectorConfig, error) {
return outconfig, nil
}
//////////////////////////////////////////////////////////////////////////////
// Run collector
//////////////////////////////////////////////////////////////////////////////
@ -171,7 +171,9 @@ func RunCollector(config InternalCollectorConfig) ([]string, error) {
lines := strings.Split(string(stdout), "\n")
for _, l := range lines {
if strings.HasPrefix(l, "#") { continue }
if strings.HasPrefix(l, "#") {
continue
}
results = append(results, l)
}
return results, err
@ -189,11 +191,11 @@ func SetupSink(config GlobalConfig) chan string {
}
func RunSink(config GlobalConfig, queue *chan string) (*time.Ticker, chan bool) {
var interval time.Duration
interval = time.Duration(config.Report.Interval) * time.Second
interval := time.Duration(config.Report.Interval) * time.Second
ticker := time.NewTicker(interval)
done := make(chan bool)
go func() {
for {
select {
@ -229,19 +231,17 @@ func CloseSink(config GlobalConfig, queue *chan string, ticker *time.Ticker, don
close(*queue)
}
func MainLoop(config GlobalConfig, sink *chan string) (*time.Ticker, chan bool) {
var intConfig []InternalCollectorConfig
intConfig, err := SetupCollectors(config)
if err != nil {
panic(err)
}
var interval time.Duration
interval = time.Duration(config.Schedule.Node.Frequency) * time.Second
interval := time.Duration(config.Schedule.Node.Frequency) * time.Second
ticker := time.NewTicker(time.Second)
done := make(chan bool)
go func() {
for {
select {

0
collectors/memavg/read_memavg.go Executable file → Normal file
View File