Skip to content

Commit

Permalink
fix: REST fabricpool metric label should match ZAPI (#1794)
Browse files Browse the repository at this point in the history
* fix: REST fabricpool metric label should match ZAPI

* fix: REST fabricpool metric label should match ZAPI
  • Loading branch information
cgrinds committed Mar 7, 2023
1 parent 2d53273 commit 2871d4c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cmd/collectors/restperf/plugins/fabricpool/fabricpool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package fabricpool

import (
"github.com/netapp/harvest/v2/cmd/poller/plugin"
"github.com/netapp/harvest/v2/pkg/matrix"
"strings"
)

type FabricPool struct {
*plugin.AbstractPlugin
}

func New(p *plugin.AbstractPlugin) plugin.Plugin {
return &FabricPool{AbstractPlugin: p}
}

// Run converts Rest lowercase metric names to uppercase to match ZapiPerf
func (f *FabricPool) Run(data *matrix.Matrix) ([]*matrix.Matrix, error) {
for _, metric := range data.GetMetrics() {
if !metric.IsArray() {
continue
}
v := metric.GetLabel("metric")
if v != "" {
metric.SetLabel("metric", strings.ToUpper(v))
}
}

return nil, nil
}
3 changes: 3 additions & 0 deletions cmd/collectors/restperf/restperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package restperf
import (
rest2 "github.com/netapp/harvest/v2/cmd/collectors/rest"
"github.com/netapp/harvest/v2/cmd/collectors/restperf/plugins/disk"
"github.com/netapp/harvest/v2/cmd/collectors/restperf/plugins/fabricpool"
"github.com/netapp/harvest/v2/cmd/collectors/restperf/plugins/fcp"
"github.com/netapp/harvest/v2/cmd/collectors/restperf/plugins/headroom"
"github.com/netapp/harvest/v2/cmd/collectors/restperf/plugins/nic"
Expand Down Expand Up @@ -1094,6 +1095,8 @@ func (r *RestPerf) LoadPlugin(kind string, p *plugin.AbstractPlugin) plugin.Plug
return disk.New(p)
case "Vscan":
return vscan.New(p)
case "FabricPool":
return fabricpool.New(p)
default:
r.Logger.Info().Str("kind", kind).Msg("no Restperf plugin found")
}
Expand Down
3 changes: 3 additions & 0 deletions conf/restperf/9.12.0/wafl_comp_aggr_vol_bin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ counters:
- cloud_bin_op => cloud_bin_operation
- cloud_bin_op_latency_average

plugins:
- FabricPool

export_options:
instance_keys:
- svm
Expand Down

0 comments on commit 2871d4c

Please sign in to comment.