diff --git a/src/go/plugin/go.d/modules/storcli/charts.go b/src/go/plugin/go.d/modules/storcli/charts.go index 3e0c07c1d1..6d7b2e14d0 100644 --- a/src/go/plugin/go.d/modules/storcli/charts.go +++ b/src/go/plugin/go.d/modules/storcli/charts.go @@ -14,6 +14,7 @@ const ( prioControllerHealthStatus = module.Priority + iota prioControllerStatus prioControllerBBUStatus + prioControllerROCTemperature prioPhysDriveErrors prioPhysDrivePredictiveFailures @@ -31,6 +32,7 @@ var controllerMegaraidChartsTmpl = module.Charts{ var controllerMpt3sasChartsTmpl = module.Charts{ controllerHealthStatusChartTmpl.Copy(), + controllerROCTemperatureChartTmpl.Copy(), } var ( @@ -76,6 +78,18 @@ var ( {ID: "cntrl_%s_bbu_status_na", Name: "na"}, }, } + controllerROCTemperatureChartTmpl = module.Chart{ + ID: "controller_%s_roc_temperature", + Title: "Controller ROC temperature", + Units: "Celsius", + Fam: "cntrl roc temperature", + Ctx: "storcli.controller_roc_temperature", + Type: module.Line, + Priority: prioControllerROCTemperature, + Dims: module.Dims{ + {ID: "cntrl_%s_roc_temperature_celsius", Name: "temperature"}, + }, + } ) var physDriveChartsTmpl = module.Charts{ @@ -165,6 +179,9 @@ func (s *StorCli) addControllerCharts(cntrl controllerInfo) { charts = controllerMegaraidChartsTmpl.Copy() case driverNameSas: charts = controllerMpt3sasChartsTmpl.Copy() + if !strings.EqualFold(cntrl.HwCfg.TemperatureSensorForROC, "present") { + _ = charts.Remove(controllerROCTemperatureChartTmpl.ID) + } default: return } diff --git a/src/go/plugin/go.d/modules/storcli/collect_controllers.go b/src/go/plugin/go.d/modules/storcli/collect_controllers.go index 64d6159464..b25c973ac0 100644 --- a/src/go/plugin/go.d/modules/storcli/collect_controllers.go +++ b/src/go/plugin/go.d/modules/storcli/collect_controllers.go @@ -33,6 +33,10 @@ type ( ControllerStatus string `json:"Controller Status"` BBUStatus *storNumber `json:"BBU Status"` } `json:"Status"` + HwCfg struct { + TemperatureSensorForROC string `json:"Temperature Sensor for ROC"` + ROCTemperatureC int `json:"ROC temperature(Degree Celsius)"` + } `json:"HwCfg"` BBUInfo []struct { Model string `json:"Model"` State string `json:"State"` @@ -119,11 +123,16 @@ func (s *StorCli) collectMpt3sasControllersInfo(mx map[string]int64, resp *contr for _, st := range []string{"healthy", "unhealthy"} { mx[px+"health_status_"+st] = 0 } - if strings.ToLower(cntrl.Status.ControllerStatus) == "ok" { + + if strings.EqualFold(cntrl.Status.ControllerStatus, "ok") { mx[px+"health_status_healthy"] = 1 } else { mx[px+"health_status_unhealthy"] = 1 } + + if strings.EqualFold(cntrl.HwCfg.TemperatureSensorForROC, "present") { + mx[px+"roc_temperature_celsius"] = int64(cntrl.HwCfg.ROCTemperatureC) + } } return nil diff --git a/src/go/plugin/go.d/modules/storcli/metadata.yaml b/src/go/plugin/go.d/modules/storcli/metadata.yaml index 7e807f056a..ab8c13276f 100644 --- a/src/go/plugin/go.d/modules/storcli/metadata.yaml +++ b/src/go/plugin/go.d/modules/storcli/metadata.yaml @@ -138,6 +138,12 @@ modules: - name: healthy - name: unhealthy - name: na + - name: storcli.controller_roc_temperature + description: Controller ROC temperature + unit: Celsius + chart_type: line + dimensions: + - name: temperature - name: physical drive description: These metrics refer to the Physical Drive. labels: diff --git a/src/go/plugin/go.d/modules/storcli/storcli_test.go b/src/go/plugin/go.d/modules/storcli/storcli_test.go index ba1a0fb161..68768afda8 100644 --- a/src/go/plugin/go.d/modules/storcli/storcli_test.go +++ b/src/go/plugin/go.d/modules/storcli/storcli_test.go @@ -205,6 +205,7 @@ func TestStorCli_Collect(t *testing.T) { wantMetrics: map[string]int64{ "cntrl_0_health_status_healthy": 1, "cntrl_0_health_status_unhealthy": 0, + "cntrl_0_roc_temperature_celsius": 44, }, }, "err on exec": {