-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Harvest should collect adaptive QOS policy groups (#1847)
* feat: Harvest should collect adaptive QOS policy groups Thanks to faguayot for reporting * feat: Harvest should collect adaptive QOS policy groups Thanks to faguayot for reporting
- Loading branch information
Showing
9 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
cmd/collectors/rest/plugins/qospolicyadaptive/qospolicyadaptive.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package qospolicyadaptive | ||
|
||
import ( | ||
"github.com/netapp/harvest/v2/cmd/collectors/zapi/plugins/qospolicyfixed" | ||
"github.com/netapp/harvest/v2/cmd/poller/plugin" | ||
"github.com/netapp/harvest/v2/pkg/matrix" | ||
) | ||
|
||
type QosPolicyAdaptive struct { | ||
*plugin.AbstractPlugin | ||
} | ||
|
||
func New(p *plugin.AbstractPlugin) plugin.Plugin { | ||
return &QosPolicyAdaptive{AbstractPlugin: p} | ||
} | ||
|
||
func (p *QosPolicyAdaptive) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, error) { | ||
data := dataMap[p.Object] | ||
for _, instance := range data.GetInstances() { | ||
p.setIOPs(instance, "absolute_min_iops") | ||
p.setIOPs(instance, "expected_iops") | ||
p.setIOPs(instance, "peak_iops") | ||
} | ||
|
||
return nil, nil | ||
} | ||
|
||
func (p *QosPolicyAdaptive) setIOPs(instance *matrix.Instance, labelName string) { | ||
val := instance.GetLabel(labelName) | ||
xput, err := qospolicyfixed.ZapiXputToRest(val) | ||
if err != nil { | ||
p.Logger.Warn().Str("label", labelName).Str("val", val).Msg("Unable to convert label, skipping") | ||
return | ||
} | ||
instance.SetLabel(labelName, xput.IOPS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
cmd/collectors/zapi/plugins/qospolicyadaptive/qospolicyadaptive.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package qospolicyadaptive | ||
|
||
import ( | ||
"github.com/netapp/harvest/v2/cmd/collectors/zapi/plugins/qospolicyfixed" | ||
"github.com/netapp/harvest/v2/cmd/poller/plugin" | ||
"github.com/netapp/harvest/v2/pkg/matrix" | ||
) | ||
|
||
type QosPolicyAdaptive struct { | ||
*plugin.AbstractPlugin | ||
} | ||
|
||
func New(p *plugin.AbstractPlugin) plugin.Plugin { | ||
return &QosPolicyAdaptive{AbstractPlugin: p} | ||
} | ||
|
||
func (p *QosPolicyAdaptive) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, error) { | ||
data := dataMap[p.Object] | ||
for _, instance := range data.GetInstances() { | ||
p.setIOPs(instance, "absolute_min_iops") | ||
p.setIOPs(instance, "expected_iops") | ||
p.setIOPs(instance, "peak_iops") | ||
} | ||
|
||
return nil, nil | ||
} | ||
|
||
func (p *QosPolicyAdaptive) setIOPs(instance *matrix.Instance, labelName string) { | ||
val := instance.GetLabel(labelName) | ||
xput, err := qospolicyfixed.ZapiXputToRest(val) | ||
if err != nil { | ||
p.Logger.Warn().Str("label", labelName).Str("val", val).Msg("Unable to convert label, skipping") | ||
return | ||
} | ||
instance.SetLabel(labelName, xput.IOPS) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
name: QosPolicyAdaptive | ||
query: api/private/cli/qos/adaptive-policy-group | ||
object: qos_policy_adaptive | ||
|
||
counters: | ||
- ^^uuid => uuid | ||
- ^policy_group => name | ||
- ^vserver => svm | ||
- ^absolute_min_iops => absolute_min_iops | ||
- ^expected_iops => expected_iops | ||
- ^expected_iops_allocation => expected_iops_allocation | ||
- ^num_workloads => object_count | ||
- ^peak_iops => peak_iops | ||
- ^peak_iops_allocation => peak_iops_allocation | ||
|
||
plugins: | ||
- QosPolicyAdaptive | ||
|
||
export_options: | ||
instance_keys: | ||
- svm | ||
instance_labels: | ||
- name | ||
- absolute_min_iops | ||
- expected_iops | ||
- expected_iops_allocation | ||
- object_count | ||
- peak_iops | ||
- peak_iops_allocation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
name: QosPolicyAdaptive | ||
query: qos-adaptive-policy-group-get-iter | ||
object: qos_policy_adaptive | ||
|
||
counters: | ||
qos-adaptive-policy-group-info: | ||
- ^^uuid => uuid | ||
- ^policy-group => name | ||
- ^vserver => svm | ||
- ^absolute-min-iops => absolute_min_iops | ||
- ^expected-iops => expected_iops | ||
- ^expected-iops-allocation => expected_iops_allocation | ||
- ^num-workloads => object_count | ||
- ^peak-iops => peak_iops | ||
- ^peak-iops-allocation => peak_iops_allocation | ||
|
||
collect_only_labels: true | ||
|
||
plugins: | ||
- QosPolicyAdaptive | ||
|
||
export_options: | ||
instance_keys: | ||
- svm | ||
instance_labels: | ||
- name | ||
- absolute_min_iops | ||
- expected_iops | ||
- expected_iops_allocation | ||
- object_count | ||
- peak_iops | ||
- peak_iops_allocation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters