Skip to content

Commit

Permalink
feat: handled dependent labels in gjson itself
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardikl committed Sep 28, 2023
1 parent b692559 commit 9c3c5d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmd/collectors/rest/plugins/netroute/netroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func (n *NetRoute) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, err
interfaces := instance.GetLabel("interfaces")

interfacesList := gjson.Result{Type: gjson.JSON, Raw: interfaces}
names := interfacesList.Get("..#.name").Array()
address := interfacesList.Get("..#.ip.address").Array()
names := interfacesList.Get("name").Array()
address := interfacesList.Get("address").Array()

if names != nil && address != nil {
if len(names) == len(address) {
Expand Down
18 changes: 9 additions & 9 deletions conf/rest/9.12.0/netroute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ query: api/network/ip/routes
object: net_route

counters:
- ^^uuid => uuid
- ^destination.address => destination
- ^destination.family => family
- ^destination.netmask => netmask_length
- ^gateway => gateway
- ^interfaces => interfaces # Added in Ontap 9.9
- ^ipspace.name => ipspace
- ^scope => scope
- ^svm.name => svm
- ^^uuid => uuid
- ^destination.address => destination
- ^destination.family => family
- ^destination.netmask => netmask_length
- ^gateway => gateway
- ^ipspace.name => ipspace
- ^scope => scope
- ^svm.name => svm
- ^{interfaces.#.name,interfaces.#.ip.address} => interfaces # Added in Ontap 9.9
- hidden_fields:
- interfaces

Expand Down

0 comments on commit 9c3c5d3

Please sign in to comment.