@cryptotaxi247 / netdata-1 / commits / ff3866ead

[storcli] Support for controller ROC temperature. (#18732)

Co-authored-by: ilyam8 <ilya@netdata.cloud>

Russell Harmon committed Oct 9, 2024 at 02:05 UTC ff3866ead798b4ceeae82d99bdf55e8dc8c7415b
4 files changed +34 -1
src/go/plugin/go.d/modules/storcli/charts.go
+17
@@ -14,6 +14,7 @@ const (
14 prioControllerHealthStatus = module.Priority + iota
15 prioControllerStatus
16 prioControllerBBUStatus
17 + prioControllerROCTemperature
18
19 prioPhysDriveErrors
20 prioPhysDrivePredictiveFailures
@@ -31,6 +32,7 @@ var controllerMegaraidChartsTmpl = module.Charts{
32
33 var controllerMpt3sasChartsTmpl = module.Charts{
34 controllerHealthStatusChartTmpl.Copy(),
35 + controllerROCTemperatureChartTmpl.Copy(),
36 }
37
38 var (
@@ -76,6 +78,18 @@ var (
78 {ID: "cntrl_%s_bbu_status_na", Name: "na"},
79 },
80 }
81 + controllerROCTemperatureChartTmpl = module.Chart{
82 + ID: "controller_%s_roc_temperature",
83 + Title: "Controller ROC temperature",
84 + Units: "Celsius",
85 + Fam: "cntrl roc temperature",
86 + Ctx: "storcli.controller_roc_temperature",
87 + Type: module.Line,
88 + Priority: prioControllerROCTemperature,
89 + Dims: module.Dims{
90 + {ID: "cntrl_%s_roc_temperature_celsius", Name: "temperature"},
91 + },
92 + }
93 )
94
95 var physDriveChartsTmpl = module.Charts{
@@ -165,6 +179,9 @@ func (s *StorCli) addControllerCharts(cntrl controllerInfo) {
179 charts = controllerMegaraidChartsTmpl.Copy()
180 case driverNameSas:
181 charts = controllerMpt3sasChartsTmpl.Copy()
182 + if !strings.EqualFold(cntrl.HwCfg.TemperatureSensorForROC, "present") {
183 + _ = charts.Remove(controllerROCTemperatureChartTmpl.ID)
184 + }
185 default:
186 return
187 }
src/go/plugin/go.d/modules/storcli/collect_controllers.go
+10 -1
@@ -33,6 +33,10 @@ type (
33 ControllerStatus string `json:"Controller Status"`
34 BBUStatus *storNumber `json:"BBU Status"`
35 } `json:"Status"`
36 + HwCfg struct {
37 + TemperatureSensorForROC string `json:"Temperature Sensor for ROC"`
38 + ROCTemperatureC int `json:"ROC temperature(Degree Celsius)"`
39 + } `json:"HwCfg"`
40 BBUInfo []struct {
41 Model string `json:"Model"`
42 State string `json:"State"`
@@ -119,11 +123,16 @@ func (s *StorCli) collectMpt3sasControllersInfo(mx map[string]int64, resp *contr
123 for _, st := range []string{"healthy", "unhealthy"} {
124 mx[px+"health_status_"+st] = 0
125 }
122 - if strings.ToLower(cntrl.Status.ControllerStatus) == "ok" {
126 +
127 + if strings.EqualFold(cntrl.Status.ControllerStatus, "ok") {
128 mx[px+"health_status_healthy"] = 1
129 } else {
130 mx[px+"health_status_unhealthy"] = 1
131 }
132 +
133 + if strings.EqualFold(cntrl.HwCfg.TemperatureSensorForROC, "present") {
134 + mx[px+"roc_temperature_celsius"] = int64(cntrl.HwCfg.ROCTemperatureC)
135 + }
136 }
137
138 return nil
src/go/plugin/go.d/modules/storcli/metadata.yaml
+6
@@ -138,6 +138,12 @@ modules:
138 - name: healthy
139 - name: unhealthy
140 - name: na
141 + - name: storcli.controller_roc_temperature
142 + description: Controller ROC temperature
143 + unit: Celsius
144 + chart_type: line
145 + dimensions:
146 + - name: temperature
147 - name: physical drive
148 description: These metrics refer to the Physical Drive.
149 labels:
src/go/plugin/go.d/modules/storcli/storcli_test.go
+1
@@ -205,6 +205,7 @@ func TestStorCli_Collect(t *testing.T) {
205 wantMetrics: map[string]int64{
206 "cntrl_0_health_status_healthy": 1,
207 "cntrl_0_health_status_unhealthy": 0,
208 + "cntrl_0_roc_temperature_celsius": 44,
209 },
210 },
211 "err on exec": {