mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-01-13 15:49:06 +01:00
Formatting
This commit is contained in:
parent
a88ea4fd43
commit
9232dd9732
@ -1,14 +1,20 @@
|
|||||||
# Use central installation
|
# Use central installation
|
||||||
CENTRAL_INSTALL = false
|
CENTRAL_INSTALL = true
|
||||||
|
|
||||||
# Path to central installation (if CENTRAL_INSTALL=true)
|
# Path to central installation (if CENTRAL_INSTALL=true)
|
||||||
LIKWID_BASE=/usr/local
|
LIKWID_BASE=/apps/likwid/5.2.0
|
||||||
# LIKWID version (should be same major version as central installation, 5.1.x)
|
# LIKWID version (should be same major version as central installation, 5.1.x)
|
||||||
LIKWID_VERSION = 5.1.0
|
LIKWID_VERSION = 5.2.0
|
||||||
# Target user for LIKWID's accessdaemon (if CENTRAL_INSTALL=false)
|
|
||||||
DAEMON_USER=root
|
#######################################################################
|
||||||
# Target group for LIKWID's accessdaemon (if CENTRAL_INSTALL=false)
|
# if CENTRAL_INSTALL=false
|
||||||
DAEMON_GROUP=root
|
#######################################################################
|
||||||
|
# Target user for LIKWID's accessdaemon
|
||||||
|
DAEMON_USER=unrz139
|
||||||
|
# Target group for LIKWID's accessdaemon
|
||||||
|
DAEMON_GROUP=unrz
|
||||||
|
# Folder for the group files
|
||||||
|
GROUP_FOLDER=/usr/local/share/likwid/perfgroups/
|
||||||
|
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
@ -21,7 +27,7 @@ ifneq ($(strip $(CENTRAL_INSTALL)),true)
|
|||||||
LIKWID_BASE := $(shell pwd)/$(INSTALL_FOLDER)
|
LIKWID_BASE := $(shell pwd)/$(INSTALL_FOLDER)
|
||||||
DAEMON_BASE := $(LIKWID_BASE)
|
DAEMON_BASE := $(LIKWID_BASE)
|
||||||
GROUPS_BASE := $(LIKWID_BASE)/groups
|
GROUPS_BASE := $(LIKWID_BASE)/groups
|
||||||
all: $(INSTALL_FOLDER)/liblikwid.a $(INSTALL_FOLDER)/likwid-accessD cleanup prepare_collector
|
all: $(INSTALL_FOLDER)/liblikwid.a cleanup prepare_collector
|
||||||
else
|
else
|
||||||
DAEMON_BASE= $(LIKWID_BASE)/sbin
|
DAEMON_BASE= $(LIKWID_BASE)/sbin
|
||||||
GROUPS_BASE := $(LIKWID_BASE)/share/likwid/perfgroups
|
GROUPS_BASE := $(LIKWID_BASE)/share/likwid/perfgroups
|
||||||
@ -45,6 +51,7 @@ $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION): $(BUILD_FOLDER)/likwid-$(LIKWID_VERSIO
|
|||||||
$(INSTALL_FOLDER)/liblikwid.a: $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION) $(INSTALL_FOLDER)
|
$(INSTALL_FOLDER)/liblikwid.a: $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION) $(INSTALL_FOLDER)
|
||||||
sed -i -e s+"PREFIX ?= .*"+"PREFIX = $(LIKWID_BASE)"+g \
|
sed -i -e s+"PREFIX ?= .*"+"PREFIX = $(LIKWID_BASE)"+g \
|
||||||
-e s+"SHARED_LIBRARY = .*"+"SHARED_LIBRARY = false"+g \
|
-e s+"SHARED_LIBRARY = .*"+"SHARED_LIBRARY = false"+g \
|
||||||
|
-e s+"ACCESSMODE = .*"+"ACCESSMODE = accessdaemon"+g \
|
||||||
-e s+"INSTALLED_ACCESSDAEMON = .*"+"INSTALLED_ACCESSDAEMON = $(DAEMON_BASE)/likwid-accessD"+g \
|
-e s+"INSTALLED_ACCESSDAEMON = .*"+"INSTALLED_ACCESSDAEMON = $(DAEMON_BASE)/likwid-accessD"+g \
|
||||||
-e s+"LIKWIDGROUPPATH = .*"+"LIKWIDGROUPPATH = $(GROUPS_BASE)"+g \
|
-e s+"LIKWIDGROUPPATH = .*"+"LIKWIDGROUPPATH = $(GROUPS_BASE)"+g \
|
||||||
$(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/config.mk
|
$(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/config.mk
|
||||||
@ -64,3 +71,8 @@ prepare_collector: likwidMetric.go
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
rm -rf $(BUILD_FOLDER)
|
rm -rf $(BUILD_FOLDER)
|
||||||
|
|
||||||
|
clean: cleanup
|
||||||
|
rm -rf likwid
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const CPUSTATFILE = `/proc/stat`
|
const CPUSTATFILE = `/proc/stat`
|
||||||
@ -34,7 +34,6 @@ func (m *CpustatCollector) Init(config []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func ParseStatLine(line string, cpu int, exclude []string, out *[]lp.MutableMetric) {
|
func ParseStatLine(line string, cpu int, exclude []string, out *[]lp.MutableMetric) {
|
||||||
ls := strings.Fields(line)
|
ls := strings.Fields(line)
|
||||||
matches := []string{"", "cpu_user", "cpu_nice", "cpu_system", "cpu_idle", "cpu_iowait", "cpu_irq", "cpu_softirq", "cpu_steal", "cpu_guest", "cpu_guest_nice"}
|
matches := []string{"", "cpu_user", "cpu_nice", "cpu_system", "cpu_idle", "cpu_iowait", "cpu_irq", "cpu_softirq", "cpu_steal", "cpu_guest", "cpu_guest_nice"}
|
||||||
@ -62,7 +61,7 @@ func ParseStatLine(line string, cpu int, exclude []string, out *[]lp.MutableMetr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *CpustatCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
|
func (m *CpustatCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
|
||||||
if (!m.init) {
|
if !m.init {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
buffer, err := ioutil.ReadFile(string(CPUSTATFILE))
|
buffer, err := ioutil.ReadFile(string(CPUSTATFILE))
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"time"
|
|
||||||
"encoding/json"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const CUSTOMCMDPATH = `/home/unrz139/Work/cc-metric-collector/collectors/custom`
|
const CUSTOMCMDPATH = `/home/unrz139/Work/cc-metric-collector/collectors/custom`
|
||||||
|
@ -3,12 +3,12 @@ package collectors
|
|||||||
import (
|
import (
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
// "log"
|
// "log"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const DISKSTATFILE = `/proc/diskstats`
|
const DISKSTATFILE = `/proc/diskstats`
|
||||||
@ -24,7 +24,6 @@ type DiskstatCollector struct {
|
|||||||
config DiskstatCollectorConfig
|
config DiskstatCollectorConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (m *DiskstatCollector) Init(config []byte) error {
|
func (m *DiskstatCollector) Init(config []byte) error {
|
||||||
var err error
|
var err error
|
||||||
m.name = "DiskstatCollector"
|
m.name = "DiskstatCollector"
|
||||||
@ -58,7 +57,7 @@ func (m *DiskstatCollector) Init(config []byte) error {
|
|||||||
m.matches = make(map[int]string)
|
m.matches = make(map[int]string)
|
||||||
for k, v := range matches {
|
for k, v := range matches {
|
||||||
_, skip := stringArrayContains(m.config.ExcludeMetrics, v)
|
_, skip := stringArrayContains(m.config.ExcludeMetrics, v)
|
||||||
if (!skip) {
|
if !skip {
|
||||||
m.matches[k] = v
|
m.matches[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,7 +71,6 @@ func (m *DiskstatCollector) Init(config []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (m *DiskstatCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
|
func (m *DiskstatCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
|
||||||
var lines []string
|
var lines []string
|
||||||
if !m.init {
|
if !m.init {
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
// "os"
|
// "os"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const BASEPATH = `/sys/class/infiniband/`
|
const BASEPATH = `/sys/class/infiniband/`
|
||||||
@ -46,7 +46,7 @@ func (m *InfinibandCollector) Init(config []byte) error {
|
|||||||
m.lids = make(map[string]map[string]string)
|
m.lids = make(map[string]map[string]string)
|
||||||
p := fmt.Sprintf("%s/*/ports/*/lid", string(BASEPATH))
|
p := fmt.Sprintf("%s/*/ports/*/lid", string(BASEPATH))
|
||||||
files, err := filepath.Glob(p)
|
files, err := filepath.Glob(p)
|
||||||
for _, f := range(files) {
|
for _, f := range files {
|
||||||
lid, err := ioutil.ReadFile(f)
|
lid, err := ioutil.ReadFile(f)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
plist := strings.Split(strings.Replace(f, string(BASEPATH), "", -1), "/")
|
plist := strings.Split(strings.Replace(f, string(BASEPATH), "", -1), "/")
|
||||||
@ -69,7 +69,7 @@ func (m *InfinibandCollector) Init(config []byte) error {
|
|||||||
command := exec.Command(PERFQUERY, args)
|
command := exec.Command(PERFQUERY, args)
|
||||||
command.Wait()
|
command.Wait()
|
||||||
_, err := command.Output()
|
_, err := command.Output()
|
||||||
if (err == nil) {
|
if err == nil {
|
||||||
m.use_perfquery = true
|
m.use_perfquery = true
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -155,7 +155,7 @@ func (m *InfinibandCollector) Read(interval time.Duration, out *[]lp.MutableMetr
|
|||||||
if m.init {
|
if m.init {
|
||||||
for dev, ports := range m.lids {
|
for dev, ports := range m.lids {
|
||||||
for port, lid := range ports {
|
for port, lid := range ports {
|
||||||
tags := map[string]string{"type" : "node", "device" : dev, "port" : port}
|
tags := map[string]string{"type": "node", "device": dev, "port": port}
|
||||||
if m.use_perfquery {
|
if m.use_perfquery {
|
||||||
DoPerfQuery(dev, lid, port, tags, out)
|
DoPerfQuery(dev, lid, port, tags, out)
|
||||||
} else {
|
} else {
|
||||||
@ -165,48 +165,47 @@ func (m *InfinibandCollector) Read(interval time.Duration, out *[]lp.MutableMetr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// buffer, err := ioutil.ReadFile(string(LIDFILE))
|
||||||
|
|
||||||
// buffer, err := ioutil.ReadFile(string(LIDFILE))
|
// if err != nil {
|
||||||
|
// log.Print(err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
// if err != nil {
|
// args := fmt.Sprintf("-r %s 1 0xf000", string(buffer))
|
||||||
// log.Print(err)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// args := fmt.Sprintf("-r %s 1 0xf000", string(buffer))
|
// command := exec.Command(PERFQUERY, args)
|
||||||
|
// command.Wait()
|
||||||
|
// stdout, err := command.Output()
|
||||||
|
// if err != nil {
|
||||||
|
// log.Print(err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
// command := exec.Command(PERFQUERY, args)
|
// ll := strings.Split(string(stdout), "\n")
|
||||||
// command.Wait()
|
|
||||||
// stdout, err := command.Output()
|
|
||||||
// if err != nil {
|
|
||||||
// log.Print(err)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ll := strings.Split(string(stdout), "\n")
|
// for _, line := range ll {
|
||||||
|
// if strings.HasPrefix(line, "PortRcvData") || strings.HasPrefix(line, "RcvData") {
|
||||||
// for _, line := range ll {
|
// lv := strings.Fields(line)
|
||||||
// if strings.HasPrefix(line, "PortRcvData") || strings.HasPrefix(line, "RcvData") {
|
// v, err := strconv.ParseFloat(lv[1], 64)
|
||||||
// lv := strings.Fields(line)
|
// if err == nil {
|
||||||
// v, err := strconv.ParseFloat(lv[1], 64)
|
// y, err := lp.New("ib_recv", m.tags, map[string]interface{}{"value": float64(v)}, time.Now())
|
||||||
// if err == nil {
|
// if err == nil {
|
||||||
// y, err := lp.New("ib_recv", m.tags, map[string]interface{}{"value": float64(v)}, time.Now())
|
// *out = append(*out, y)
|
||||||
// if err == nil {
|
// }
|
||||||
// *out = append(*out, y)
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// if strings.HasPrefix(line, "PortXmitData") || strings.HasPrefix(line, "XmtData") {
|
||||||
// }
|
// lv := strings.Fields(line)
|
||||||
// if strings.HasPrefix(line, "PortXmitData") || strings.HasPrefix(line, "XmtData") {
|
// v, err := strconv.ParseFloat(lv[1], 64)
|
||||||
// lv := strings.Fields(line)
|
// if err == nil {
|
||||||
// v, err := strconv.ParseFloat(lv[1], 64)
|
// y, err := lp.New("ib_xmit", m.tags, map[string]interface{}{"value": float64(v)}, time.Now())
|
||||||
// if err == nil {
|
// if err == nil {
|
||||||
// y, err := lp.New("ib_xmit", m.tags, map[string]interface{}{"value": float64(v)}, time.Now())
|
// *out = append(*out, y)
|
||||||
// if err == nil {
|
// }
|
||||||
// *out = append(*out, y)
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *InfinibandCollector) Close() {
|
func (m *InfinibandCollector) Close() {
|
||||||
|
@ -9,19 +9,19 @@ package collectors
|
|||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"log"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
"os"
|
|
||||||
"unsafe"
|
|
||||||
"math"
|
|
||||||
"encoding/json"
|
|
||||||
"gopkg.in/Knetic/govaluate.v2"
|
"gopkg.in/Knetic/govaluate.v2"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"math"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LikwidCollectorMetricConfig struct {
|
type LikwidCollectorMetricConfig struct {
|
||||||
@ -40,6 +40,7 @@ type LikwidCollectorConfig struct {
|
|||||||
Eventsets []LikwidCollectorEventsetConfig `json:"eventsets"`
|
Eventsets []LikwidCollectorEventsetConfig `json:"eventsets"`
|
||||||
Metrics []LikwidCollectorMetricConfig `json:"globalmetrics"`
|
Metrics []LikwidCollectorMetricConfig `json:"globalmetrics"`
|
||||||
ExcludeMetrics []string `json:"exclude_metrics"`
|
ExcludeMetrics []string `json:"exclude_metrics"`
|
||||||
|
ForceOverwrite bool `json:"force_overwrite"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LikwidCollector struct {
|
type LikwidCollector struct {
|
||||||
@ -106,7 +107,7 @@ func getBaseFreq() float64 {
|
|||||||
data := strings.Replace(string(buffer), "\n", "", -1)
|
data := strings.Replace(string(buffer), "\n", "", -1)
|
||||||
x, err := strconv.ParseInt(data, 0, 64)
|
x, err := strconv.ParseInt(data, 0, 64)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
freq = float64(x)*1E3
|
freq = float64(x) * 1e3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +156,9 @@ func (m *LikwidCollector) Init(config []byte) error {
|
|||||||
if ret != 0 {
|
if ret != 0 {
|
||||||
return errors.New("Failed to initialize LIKWID topology")
|
return errors.New("Failed to initialize LIKWID topology")
|
||||||
}
|
}
|
||||||
|
if m.config.ForceOverwrite {
|
||||||
os.Setenv("LIKWID_FORCE", "1")
|
os.Setenv("LIKWID_FORCE", "1")
|
||||||
|
}
|
||||||
ret = C.perfmon_init(C.int(len(m.cpulist)), &m.cpulist[0])
|
ret = C.perfmon_init(C.int(len(m.cpulist)), &m.cpulist[0])
|
||||||
if ret != 0 {
|
if ret != 0 {
|
||||||
C.topology_finalize()
|
C.topology_finalize()
|
||||||
@ -223,14 +226,14 @@ func (m *LikwidCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
|
|||||||
m.results[i][tid][gctr] = float64(res)
|
m.results[i][tid][gctr] = float64(res)
|
||||||
}
|
}
|
||||||
m.results[i][tid]["time"] = float64(interval)
|
m.results[i][tid]["time"] = float64(interval)
|
||||||
m.results[i][tid]["inverseClock"] = float64(1.0/m.basefreq)
|
m.results[i][tid]["inverseClock"] = float64(1.0 / m.basefreq)
|
||||||
for _, metric := range evset.Metrics {
|
for _, metric := range evset.Metrics {
|
||||||
expression, err := govaluate.NewEvaluableExpression(metric.Calc)
|
expression, err := govaluate.NewEvaluableExpression(metric.Calc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err.Error())
|
log.Print(err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
result, err := expression.Evaluate(m.results[i][tid]);
|
result, err := expression.Evaluate(m.results[i][tid])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err.Error())
|
log.Print(err.Error())
|
||||||
continue
|
continue
|
||||||
@ -254,7 +257,7 @@ func (m *LikwidCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
|
|||||||
params[mname] = mres
|
params[mname] = mres
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result, err := expression.Evaluate(params);
|
result, err := expression.Evaluate(params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err.Error())
|
log.Print(err.Error())
|
||||||
continue
|
continue
|
||||||
@ -319,7 +322,6 @@ func (m *LikwidCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (m *LikwidCollector) Close() {
|
func (m *LikwidCollector) Close() {
|
||||||
if m.init {
|
if m.init {
|
||||||
m.init = false
|
m.init = false
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const LOADAVGFILE = `/proc/loadavg`
|
const LOADAVGFILE = `/proc/loadavg`
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const LUSTREFILE = `/proc/fs/lustre/llite/lnec-XXXXXX/stats`
|
const LUSTREFILE = `/proc/fs/lustre/llite/lnec-XXXXXX/stats`
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
@ -9,7 +10,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const MEMSTATFILE = `/proc/meminfo`
|
const MEMSTATFILE = `/proc/meminfo`
|
||||||
@ -49,7 +49,7 @@ func (m *MemstatCollector) Init(config []byte) error {
|
|||||||
"SwapFree": "swap_free"}
|
"SwapFree": "swap_free"}
|
||||||
for k, v := range matches {
|
for k, v := range matches {
|
||||||
_, skip := stringArrayContains(m.config.ExcludeMetrics, k)
|
_, skip := stringArrayContains(m.config.ExcludeMetrics, k)
|
||||||
if (!skip) {
|
if !skip {
|
||||||
m.matches[k] = v
|
m.matches[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type MetricGetter interface {
|
type MetricGetter interface {
|
||||||
@ -151,4 +151,3 @@ func RemoveFromStringList(s []string, r string) ([]string, error) {
|
|||||||
}
|
}
|
||||||
return s, errors.New("No such string in list")
|
return s, errors.New("No such string in list")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const NETSTATFILE = `/proc/net/dev`
|
const NETSTATFILE = `/proc/net/dev`
|
||||||
@ -66,7 +66,7 @@ func (m *NetstatCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
|
|||||||
if cont {
|
if cont {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tags := map[string]string{"device" : dev, "type": "node"}
|
tags := map[string]string{"device": dev, "type": "node"}
|
||||||
for i, name := range m.matches {
|
for i, name := range m.matches {
|
||||||
v, err := strconv.ParseInt(f[i], 10, 0)
|
v, err := strconv.ParseInt(f[i], 10, 0)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
"github.com/NVIDIA/go-nvml/pkg/nvml"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type NvidiaCollectorConfig struct {
|
type NvidiaCollectorConfig struct {
|
||||||
@ -58,7 +58,7 @@ func (m *NvidiaCollector) Init(config []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *NvidiaCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
|
func (m *NvidiaCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
|
||||||
if (!m.init) {
|
if !m.init {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for i := 0; i < m.num_gpus; i++ {
|
for i := 0; i < m.num_gpus; i++ {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package collectors
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
lp "github.com/influxdata/line-protocol"
|
lp "github.com/influxdata/line-protocol"
|
||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const MAX_NUM_PROCS = 10
|
const MAX_NUM_PROCS = 10
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"likwid": {
|
"likwid": {
|
||||||
|
"accessmode" : "accessdaemon",
|
||||||
|
"daemon_path" : "/apps/likwid/5.2.0/sbin",
|
||||||
"eventsets": [
|
"eventsets": [
|
||||||
{
|
{
|
||||||
"events": {
|
"events": {
|
||||||
|
@ -240,7 +240,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
err = col.Init([]byte(conf))
|
err = col.Init([]byte(conf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("SKIP ", col.Name(), " (", err.Error(),")")
|
log.Print("SKIP ", col.Name(), " (", err.Error(), ")")
|
||||||
} else {
|
} else {
|
||||||
log.Print("Start ", col.Name())
|
log.Print("Start ", col.Name())
|
||||||
tmp = append(tmp, c)
|
tmp = append(tmp, c)
|
||||||
|
Loading…
Reference in New Issue
Block a user