mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-25 23:19:06 +01:00
Reformat, remove x bit on memavg Collector
This commit is contained in:
parent
9597798ebc
commit
4519632ef2
@ -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
0
collectors/memavg/read_memavg.go
Executable file → Normal file
Loading…
Reference in New Issue
Block a user