Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Harvest should collect the BMC firmware version #2800

Merged
merged 1 commit into from
Apr 2, 2024
Merged
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
54 changes: 47 additions & 7 deletions cmd/collectors/zapi/plugins/systemnode/systemnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,27 @@ func (s *SystemNode) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *
s.client.Metadata.Reset()
nodeStateMap := make(map[string]string)

// invoke service-processor-get-iter zapi and populate the BMC firmware version
serviceProcessorMap, err := s.getServiceProcessor()
if err != nil {
s.Logger.Error().Err(err).Msg("Failed to collect service processor info")
}

// invoke system-get-node-info-iter zapi and populate node info
partnerNameMap, err := s.getPartnerNodeInfo()
if err != nil {
s.Logger.Error().Err(err).Msg("Failed to collect partner node detail")
}

for _, node := range data.GetInstanceKeys() {
nodeStateMap[node] = data.GetInstance(node).GetLabel("healthy")
for _, aNode := range data.GetInstanceKeys() {
nodeStateMap[aNode] = data.GetInstance(aNode).GetLabel("healthy")
}

// update node instance with partner and partner_healthy info
for nodeName, node := range data.GetInstances() {
node.SetLabel("ha_partner", partnerNameMap[nodeName])
node.SetLabel("partner_healthy", nodeStateMap[node.GetLabel("ha_partner")])
// update node instance with partner, partner_healthy, and BMC version info
for nodeName, inst := range data.GetInstances() {
inst.SetLabel("ha_partner", partnerNameMap[nodeName])
inst.SetLabel("partner_healthy", nodeStateMap[inst.GetLabel("ha_partner")])
inst.SetLabel("bmc_firmware_version", serviceProcessorMap[nodeName])
}

// update node metrics with partner info
Expand Down Expand Up @@ -91,7 +98,7 @@ func (s *SystemNode) getPartnerNodeInfo() (map[string]string, error) {
}

if len(result) == 0 || result == nil {
s.Logger.Debug().Err(err).Msg("no records found")
s.Logger.Debug().Msg("no records found")
return nodePartnerNodeMap, nil
}

Expand All @@ -102,3 +109,36 @@ func (s *SystemNode) getPartnerNodeInfo() (map[string]string, error) {
}
return nodePartnerNodeMap, nil
}

func (s *SystemNode) getServiceProcessor() (map[string]string, error) {
var (
result []*node.Node
err error
)

nodeFirmwareMap := make(map[string]string) // node-name -> BMC firmware version map
request := node.NewXMLS("service-processor-get-iter")
request.NewChildS("max-records", collectors.DefaultBatchSize)

desired := node.NewXMLS("desired-attributes")
spInfo := node.NewXMLS("service-processor-info")
spInfo.NewChildS("firmware-version", "")
desired.AddChild(spInfo)
request.AddChild(desired)

if result, err = s.client.InvokeZapiCall(request); err != nil {
return nil, err
}

if len(result) == 0 || result == nil {
s.Logger.Debug().Msg("no records found")
return nodeFirmwareMap, nil
}

for _, objectStore := range result {
firmware := objectStore.GetChildContentS("firmware-version")
nodeName := objectStore.GetChildContentS("node")
nodeFirmwareMap[nodeName] = firmware
}
return nodeFirmwareMap, nil
}
2 changes: 2 additions & 0 deletions conf/rest/9.12.0/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ counters:
- ^location
- ^model
- ^serial_number => serial
- ^service_processor.firmware_version => bmc_firmware_version
- ^state
- ^uuid
- ^version.full => version
Expand Down Expand Up @@ -46,6 +47,7 @@ export_options:
- node
- serial
instance_labels:
- bmc_firmware_version
cgrinds marked this conversation as resolved.
Show resolved Hide resolved
- cpu_firmware_release
- healthy
- location
Expand Down
1 change: 1 addition & 0 deletions conf/zapi/cdot/9.8.0/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export_options:
- node
- serial
instance_labels:
- bmc_firmware_version
- cpu_firmware_release
- healthy
- location
Expand Down
1 change: 1 addition & 0 deletions docs/prepare-cdot-clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ security login role create -role harvest2-role -access readonly -cmddirname "sys
security login role create -role harvest2-role -access readonly -cmddirname "system health subsystem show"
security login role create -role harvest2-role -access readonly -cmddirname "system license show"
security login role create -role harvest2-role -access readonly -cmddirname "system node"
security login role create -role harvest2-role -access readonly -cmddirname "system service-processor show"
security login role create -role harvest2-role -access readonly -cmddirname "version"
security login role create -role harvest2-role -access readonly -cmddirname "volume"
security login role create -role harvest2-role -access readonly -cmddirname "vserver"
Expand Down
11 changes: 7 additions & 4 deletions grafana/dashboards/cmode/node.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"gnetId": null,
"graphTooltip": 1,
"id": null,
"iteration": 1707902598340,
"iteration": 1712067123953,
"links": [
{
"asDropdown": true,
Expand Down Expand Up @@ -1112,7 +1112,8 @@
"location",
"model",
"vendor",
"version"
"version",
"bmc_firmware_version"
]
}
}
Expand All @@ -1125,19 +1126,21 @@
"Value #A": 2,
"Value #B": 3,
"Value #C": 4,
"bmc_firmware_version": 10,
"cluster 1": 1,
"cpu_firmware_release": 9,
"datacenter 1": 0,
"healthy": 5,
"location": 7,
"model": 6,
"vendor": 10,
"vendor": 11,
"version": 8
},
"renameByName": {
"Value #A": "Uptime",
"Value #B": "Fan Status",
"Value #C": "Power Status",
"bmc_firmware_version": "BMC Firmware Version",
"cluster 1": "Cluster",
"cpu_firmware_release": "CPU Firmware Version",
"datacenter 1": "Datacenter",
Expand Down Expand Up @@ -5934,5 +5937,5 @@
"timezone": "",
"title": "ONTAP: Node",
"uid": "",
"version": 10
"version": 11
}
2 changes: 1 addition & 1 deletion integration/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/shirou/gopsutil/v3 v3.24.2 // indirect
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down
6 changes: 3 additions & 3 deletions integration/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shirou/gopsutil/v3 v3.24.2 h1:kcR0erMbLg5/3LcInpw0X/rrPSqq4CDPyI6A6ZRC18Y=
github.com/shirou/gopsutil/v3 v3.24.2/go.mod h1:tSg/594BcA+8UdQU2XcW803GWYgdtauFFPgJCJKZlVk=
github.com/shirou/gopsutil/v3 v3.24.3 h1:eoUGJSmdfLzJ3mxIhmOAhgKEKgQkeOwKpz1NbhVnuPE=
github.com/shirou/gopsutil/v3 v3.24.3/go.mod h1:JpND7O217xa72ewWz9zN2eIIkPWsDN/3pl0H8Qt0uwg=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
Expand All @@ -79,6 +79,7 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
Expand Down Expand Up @@ -114,7 +115,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
Expand Down
Loading