From db5b4e4f65fe21337e2c26dfe1a4a20aaabfa0e5 Mon Sep 17 00:00:00 2001 From: Holger Obermaier <40787752+ho-ob@users.noreply.github.com> Date: Fri, 28 Jan 2022 09:14:25 +0100 Subject: [PATCH] Add type=node to gpf metric tags --- collectors/gpfsMetric.go | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/collectors/gpfsMetric.go b/collectors/gpfsMetric.go index fbf3a63..f2e33c6 100644 --- a/collectors/gpfsMetric.go +++ b/collectors/gpfsMetric.go @@ -108,6 +108,11 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { continue } + tagList := map[string]string{ + "type": "node", + "filesystem": filesystem, + } + // return code rc, err := strconv.Atoi(key_value["_rc_"]) if err != nil { @@ -142,9 +147,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { } y, err := lp.New( "gpfs_bytes_read", - map[string]string{ - "filesystem": filesystem, - }, + tagList, map[string]interface{}{ "value": bytesRead, }, @@ -163,9 +166,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { } y, err = lp.New( "gpfs_bytes_written", - map[string]string{ - "filesystem": filesystem, - }, + tagList, map[string]interface{}{ "value": bytesWritten, }, @@ -184,9 +185,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { } y, err = lp.New( "gpfs_num_opens", - map[string]string{ - "filesystem": filesystem, - }, + tagList, map[string]interface{}{ "value": numOpens, }, @@ -203,9 +202,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { } y, err = lp.New( "gpfs_num_closes", - map[string]string{ - "filesystem": filesystem, - }, + tagList, map[string]interface{}{ "value": numCloses, }, @@ -222,9 +219,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { } y, err = lp.New( "gpfs_num_reads", - map[string]string{ - "filesystem": filesystem, - }, + tagList, map[string]interface{}{ "value": numReads, }, @@ -241,9 +236,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { } y, err = lp.New( "gpfs_num_writes", - map[string]string{ - "filesystem": filesystem, - }, + tagList, map[string]interface{}{ "value": numWrites, }, @@ -260,9 +253,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { } y, err = lp.New( "gpfs_num_readdirs", - map[string]string{ - "filesystem": filesystem, - }, + tagList, map[string]interface{}{ "value": numReaddirs, }, @@ -279,9 +270,7 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) { } y, err = lp.New( "gpfs_num_inode_updates", - map[string]string{ - "filesystem": filesystem, - }, + tagList, map[string]interface{}{ "value": numInodeUpdates, },