Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions cmd/collectors/commonutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ type embedShelf struct {
}

type PortData struct {
Node string
Port string
Read float64
Write float64
Node string
Port string
Read float64
Write float64
ReadPerc float64
WritePerc float64
}

// Reference https://kb.netapp.com/onprem/ontap/hardware/FAQ%3A_How_do_shelf_product_IDs_and_modules_in_ONTAP_map_to_a_model_of_a_shelf_or_storage_system_with_embedded_storage
Expand Down Expand Up @@ -482,6 +484,8 @@ func PopulateIfgroupMetrics(portIfgroupMap map[string]string, portDataMap map[st
port := portInfo.Port
readBytes := portInfo.Read
writeBytes := portInfo.Write
readPerc := portInfo.ReadPerc
writePerc := portInfo.WritePerc

ifgrpupInstanceKey := nodeName + ifgroupName
ifgroupInstance := nData.GetInstance(ifgrpupInstanceKey)
Expand Down Expand Up @@ -516,6 +520,14 @@ func PopulateIfgroupMetrics(portIfgroupMap map[string]string, portDataMap map[st
tx := nData.GetMetric("tx_bytes")
txv, _ := tx.GetValueFloat64(ifgroupInstance)
tx.SetValueFloat64(ifgroupInstance, writeBytes+txv)

rxp := nData.GetMetric("rx_perc")
rxpv, _ := rxp.GetValueFloat64(ifgroupInstance)
rxp.SetValueFloat64(ifgroupInstance, readPerc+rxpv)

txp := nData.GetMetric("tx_perc")
txpv, _ := txp.GetValueFloat64(ifgroupInstance)
txp.SetValueFloat64(ifgroupInstance, writePerc+txpv)
Comment on lines +524 to +530
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summing percentage values across ports in an aggregation group produces incorrect results. Percentages should be averaged or the maximum taken, not summed. For example, if two ports are each at 50% utilization, summing them would incorrectly report 100% instead of the actual 50% average or 50% max utilization.

Copilot uses AI. Check for mistakes.
}
return nil
}
Expand Down
4 changes: 3 additions & 1 deletion cmd/collectors/restperf/plugins/nic/nic.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type Nic struct {
var ifgrpMetrics = []string{
"rx_bytes",
"tx_bytes",
"rx_perc",
"tx_perc",
}

func New(p *plugin.AbstractPlugin) plugin.Plugin {
Expand Down Expand Up @@ -197,7 +199,7 @@ func (n *Nic) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *collect
tx.SetValueFloat64(instance, txPercent)
}

portDataMap[nodeName+port] = collectors.PortData{Node: nodeName, Port: port, Read: rxBytes, Write: txBytes}
portDataMap[nodeName+port] = collectors.PortData{Node: nodeName, Port: port, Read: rxBytes, Write: txBytes, ReadPerc: rxPercent, WritePerc: txPercent}

if rxOk || txOk {
utilPercent.SetValueFloat64(instance, math.Max(rxPercent, txPercent))
Expand Down
4 changes: 3 additions & 1 deletion cmd/collectors/zapiperf/plugins/nic/nic.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type Nic struct {
var ifgrpMetrics = []string{
"rx_bytes",
"tx_bytes",
"rx_perc",
"tx_perc",
}

func New(p *plugin.AbstractPlugin) plugin.Plugin {
Expand Down Expand Up @@ -175,7 +177,7 @@ func (n *Nic) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *collect
tx.SetValueFloat64(instance, txPercent)
}

portDataMap[nodeName+port] = collectors.PortData{Node: nodeName, Port: port, Read: rxBytes, Write: txBytes}
portDataMap[nodeName+port] = collectors.PortData{Node: nodeName, Port: port, Read: rxBytes, Write: txBytes, ReadPerc: rxPercent, WritePerc: txPercent}

if rxOk || txOk {
utilPercent.SetValueFloat64(instance, math.Max(rxPercent, txPercent))
Expand Down
24 changes: 24 additions & 0 deletions cmd/tools/generate/counter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,30 @@ counters:
ONTAPCounter: Harvest generated
Template: conf/zapiperf/cdot/9.8.0/nic_common.yaml

- Name: nic_ifgrp_rx_perc
Description: Link Aggregation Group (LAG) Bytes received percentage.
APIs:
- API: RestPerf
Endpoint: NA
ONTAPCounter: Harvest generated
Template: conf/restperf/9.12.0/nic_common.yaml
- API: ZapiPerf
Endpoint: NA
ONTAPCounter: Harvest generated
Template: conf/zapiperf/cdot/9.8.0/nic_common.yaml

- Name: nic_ifgrp_tx_perc
Description: Link Aggregation Group (LAG) Bytes sent percentage.
APIs:
- API: RestPerf
Endpoint: NA
ONTAPCounter: Harvest generated
Template: conf/restperf/9.12.0/nic_common.yaml
- API: ZapiPerf
Endpoint: NA
ONTAPCounter: Harvest generated
Template: conf/zapiperf/cdot/9.8.0/nic_common.yaml

- Name: nic_rx_percent
Description: Bytes received percentage.
APIs:
Expand Down
56 changes: 55 additions & 1 deletion docs/ontap-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ These can be generated on demand by running `bin/harvest grafana metrics`. See
- More information about ONTAP REST performance counters can be found [here](https://docs.netapp.com/us-en/ontap-pcmap-9121/index.html).

```
Creation Date : 2025-Dec-08
Creation Date : 2025-Dec-11
ONTAP Version: 9.16.1
```

Expand Down Expand Up @@ -9071,6 +9071,25 @@ The `nic_ifgrp_rx_bytes` metric is visualized in the following Grafana dashboard



### nic_ifgrp_rx_perc

Link Aggregation Group (LAG) Bytes received percentage.

| API | Endpoint | Metric | Template |
|--------|----------|--------|---------|
| RestPerf | `NA` | `Harvest generated`<br><span class="key">Unit:</span> <br><span class="key">Type:</span> <br><span class="key">Base:</span> | conf/restperf/9.12.0/nic_common.yaml |
| ZapiPerf | `NA` | `Harvest generated`<br><span class="key">Unit:</span> <br><span class="key">Type:</span> <br><span class="key">Base:</span> | conf/zapiperf/cdot/9.8.0/nic_common.yaml |

The `nic_ifgrp_rx_perc` metric is visualized in the following Grafana dashboards:

/// html | div.grafana-table
| Dashboard | Row | Type | Panel |
|--------|----------|--------|--------|
| ONTAP: Network | Link Aggregation Group (LAG) | table | [Link Aggregation Groups](/d/cdot-network/ontap3a-network?orgId=1&viewPanel=122) |
///



### nic_ifgrp_tx_bytes

Link Aggregation Group (LAG) Bytes sent.
Expand All @@ -9091,6 +9110,25 @@ The `nic_ifgrp_tx_bytes` metric is visualized in the following Grafana dashboard



### nic_ifgrp_tx_perc

Link Aggregation Group (LAG) Bytes sent percentage.

| API | Endpoint | Metric | Template |
|--------|----------|--------|---------|
| RestPerf | `NA` | `Harvest generated`<br><span class="key">Unit:</span> <br><span class="key">Type:</span> <br><span class="key">Base:</span> | conf/restperf/9.12.0/nic_common.yaml |
| ZapiPerf | `NA` | `Harvest generated`<br><span class="key">Unit:</span> <br><span class="key">Type:</span> <br><span class="key">Base:</span> | conf/zapiperf/cdot/9.8.0/nic_common.yaml |

The `nic_ifgrp_tx_perc` metric is visualized in the following Grafana dashboards:

/// html | div.grafana-table
| Dashboard | Row | Type | Panel |
|--------|----------|--------|--------|
| ONTAP: Network | Link Aggregation Group (LAG) | table | [Link Aggregation Groups](/d/cdot-network/ontap3a-network?orgId=1&viewPanel=122) |
///



### nic_labels

This metric provides information about NicCommon
Expand Down Expand Up @@ -9256,6 +9294,14 @@ Bytes received percentage.
| RestPerf | `NA` | `Harvest generated`<br><span class="key">Unit:</span> <br><span class="key">Type:</span> <br><span class="key">Base:</span> | conf/restperf/9.12.0/nic_common.yaml |
| ZapiPerf | `NA` | `Harvest generated`<br><span class="key">Unit:</span> <br><span class="key">Type:</span> <br><span class="key">Base:</span> | conf/zapiperf/cdot/9.8.0/nic_common.yaml |

The `nic_rx_percent` metric is visualized in the following Grafana dashboards:

/// html | div.grafana-table
| Dashboard | Row | Type | Panel |
|--------|----------|--------|--------|
| ONTAP: Network | Ethernet | table | [NIC ports](/d/cdot-network/ontap3a-network?orgId=1&viewPanel=58) |
///



### nic_rx_total_errors
Expand Down Expand Up @@ -9342,6 +9388,14 @@ Bytes sent percentage.
| RestPerf | `NA` | `Harvest generated`<br><span class="key">Unit:</span> <br><span class="key">Type:</span> <br><span class="key">Base:</span> | conf/restperf/9.12.0/nic_common.yaml |
| ZapiPerf | `NA` | `Harvest generated`<br><span class="key">Unit:</span> <br><span class="key">Type:</span> <br><span class="key">Base:</span> | conf/zapiperf/cdot/9.8.0/nic_common.yaml |

The `nic_tx_percent` metric is visualized in the following Grafana dashboards:

/// html | div.grafana-table
| Dashboard | Row | Type | Panel |
|--------|----------|--------|--------|
| ONTAP: Network | Ethernet | table | [NIC ports](/d/cdot-network/ontap3a-network?orgId=1&viewPanel=58) |
///



### nic_tx_total_errors
Expand Down
Loading
Loading