mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-11-10 04:27:25 +01:00
Merge branch 'develop' of github.com:ClusterCockpit/cc-metric-collector into develop
This commit is contained in:
commit
b7ee125942
@ -1,4 +1,12 @@
|
||||
{
|
||||
"cpufreq": {},
|
||||
"cpufreq_cpuinfo": {},
|
||||
"gpfs": {
|
||||
"exclude_filesystem": [ "test_fs" ]
|
||||
},
|
||||
"loadavg": {
|
||||
"exclude_metrics": [ "proc_total" ]
|
||||
}
|
||||
"tempstat": {
|
||||
"tag_override": {
|
||||
"hwmon0" : {
|
||||
@ -10,6 +18,4 @@
|
||||
"type-id" : "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,8 +21,10 @@ type GpfsCollector struct {
|
||||
metricCollector
|
||||
tags map[string]string
|
||||
config struct {
|
||||
Mmpmon string `json:"mmpmon"`
|
||||
Mmpmon string `json:"mmpmon_path,omitempty"`
|
||||
ExcludeFilesystem []string `json:"exclude_filesystem,omitempty"`
|
||||
}
|
||||
skipFS map[string]struct{}
|
||||
}
|
||||
|
||||
func (m *GpfsCollector) Init(config json.RawMessage) error {
|
||||
@ -54,6 +56,10 @@ func (m *GpfsCollector) Init(config json.RawMessage) error {
|
||||
"type": "node",
|
||||
"filesystem": "",
|
||||
}
|
||||
m.skipFS = make(map[string]struct{})
|
||||
for _, fs := range m.config.ExcludeFilesystem {
|
||||
m.skipFS[fs] = struct{}{}
|
||||
}
|
||||
|
||||
// GPFS / IBM Spectrum Scale file system statistics can only be queried by user root
|
||||
user, err := user.Current()
|
||||
@ -108,7 +114,12 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
||||
scanner := bufio.NewScanner(cmdStdout)
|
||||
for scanner.Scan() {
|
||||
lineSplit := strings.Fields(scanner.Text())
|
||||
if lineSplit[0] == "_fs_io_s_" {
|
||||
|
||||
// Only process lines starting with _fs_io_s_
|
||||
if lineSplit[0] != "_fs_io_s_" {
|
||||
continue
|
||||
}
|
||||
|
||||
key_value := make(map[string]string)
|
||||
for i := 1; i < len(lineSplit); i += 2 {
|
||||
key_value[lineSplit[i]] = lineSplit[i+1]
|
||||
@ -128,6 +139,11 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Skip excluded filesystems
|
||||
if _, skip := m.skipFS[filesystem]; skip {
|
||||
continue
|
||||
}
|
||||
|
||||
m.tags["filesystem"] = filesystem
|
||||
|
||||
// return code
|
||||
@ -257,7 +273,6 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
||||
output <- y
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m *GpfsCollector) Close() {
|
||||
|
Loading…
Reference in New Issue
Block a user