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": {
|
"tempstat": {
|
||||||
"tag_override": {
|
"tag_override": {
|
||||||
"hwmon0" : {
|
"hwmon0" : {
|
||||||
@ -10,6 +18,4 @@
|
|||||||
"type-id" : "1"
|
"type-id" : "1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,10 @@ type GpfsCollector struct {
|
|||||||
metricCollector
|
metricCollector
|
||||||
tags map[string]string
|
tags map[string]string
|
||||||
config struct {
|
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 {
|
func (m *GpfsCollector) Init(config json.RawMessage) error {
|
||||||
@ -54,6 +56,10 @@ func (m *GpfsCollector) Init(config json.RawMessage) error {
|
|||||||
"type": "node",
|
"type": "node",
|
||||||
"filesystem": "",
|
"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
|
// GPFS / IBM Spectrum Scale file system statistics can only be queried by user root
|
||||||
user, err := user.Current()
|
user, err := user.Current()
|
||||||
@ -108,7 +114,12 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
|||||||
scanner := bufio.NewScanner(cmdStdout)
|
scanner := bufio.NewScanner(cmdStdout)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
lineSplit := strings.Fields(scanner.Text())
|
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)
|
key_value := make(map[string]string)
|
||||||
for i := 1; i < len(lineSplit); i += 2 {
|
for i := 1; i < len(lineSplit); i += 2 {
|
||||||
key_value[lineSplit[i]] = lineSplit[i+1]
|
key_value[lineSplit[i]] = lineSplit[i+1]
|
||||||
@ -128,6 +139,11 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip excluded filesystems
|
||||||
|
if _, skip := m.skipFS[filesystem]; skip {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
m.tags["filesystem"] = filesystem
|
m.tags["filesystem"] = filesystem
|
||||||
|
|
||||||
// return code
|
// return code
|
||||||
@ -257,7 +273,6 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) {
|
|||||||
output <- y
|
output <- y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GpfsCollector) Close() {
|
func (m *GpfsCollector) Close() {
|
||||||
|
Loading…
Reference in New Issue
Block a user