Add type=node to gpf metric tags

This commit is contained in:
Holger Obermaier 2022-01-28 09:14:25 +01:00
parent d903fc6daa
commit db5b4e4f65

View File

@ -108,6 +108,11 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
continue continue
} }
tagList := map[string]string{
"type": "node",
"filesystem": filesystem,
}
// return code // return code
rc, err := strconv.Atoi(key_value["_rc_"]) rc, err := strconv.Atoi(key_value["_rc_"])
if err != nil { if err != nil {
@ -142,9 +147,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
} }
y, err := lp.New( y, err := lp.New(
"gpfs_bytes_read", "gpfs_bytes_read",
map[string]string{ tagList,
"filesystem": filesystem,
},
map[string]interface{}{ map[string]interface{}{
"value": bytesRead, "value": bytesRead,
}, },
@ -163,9 +166,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
} }
y, err = lp.New( y, err = lp.New(
"gpfs_bytes_written", "gpfs_bytes_written",
map[string]string{ tagList,
"filesystem": filesystem,
},
map[string]interface{}{ map[string]interface{}{
"value": bytesWritten, "value": bytesWritten,
}, },
@ -184,9 +185,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
} }
y, err = lp.New( y, err = lp.New(
"gpfs_num_opens", "gpfs_num_opens",
map[string]string{ tagList,
"filesystem": filesystem,
},
map[string]interface{}{ map[string]interface{}{
"value": numOpens, "value": numOpens,
}, },
@ -203,9 +202,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
} }
y, err = lp.New( y, err = lp.New(
"gpfs_num_closes", "gpfs_num_closes",
map[string]string{ tagList,
"filesystem": filesystem,
},
map[string]interface{}{ map[string]interface{}{
"value": numCloses, "value": numCloses,
}, },
@ -222,9 +219,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
} }
y, err = lp.New( y, err = lp.New(
"gpfs_num_reads", "gpfs_num_reads",
map[string]string{ tagList,
"filesystem": filesystem,
},
map[string]interface{}{ map[string]interface{}{
"value": numReads, "value": numReads,
}, },
@ -241,9 +236,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
} }
y, err = lp.New( y, err = lp.New(
"gpfs_num_writes", "gpfs_num_writes",
map[string]string{ tagList,
"filesystem": filesystem,
},
map[string]interface{}{ map[string]interface{}{
"value": numWrites, "value": numWrites,
}, },
@ -260,9 +253,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
} }
y, err = lp.New( y, err = lp.New(
"gpfs_num_readdirs", "gpfs_num_readdirs",
map[string]string{ tagList,
"filesystem": filesystem,
},
map[string]interface{}{ map[string]interface{}{
"value": numReaddirs, "value": numReaddirs,
}, },
@ -279,9 +270,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
} }
y, err = lp.New( y, err = lp.New(
"gpfs_num_inode_updates", "gpfs_num_inode_updates",
map[string]string{ tagList,
"filesystem": filesystem,
},
map[string]interface{}{ map[string]interface{}{
"value": numInodeUpdates, "value": numInodeUpdates,
}, },