mirror of
https://github.com/netdata/netdata.git
synced 2025-04-14 01:29:11 +00:00
[storcli] Support for controller ROC temperature. (#18732)
Co-authored-by: ilyam8 <ilya@netdata.cloud>
This commit is contained in:
parent
1cce860ab0
commit
ff3866ead7
4 changed files with 34 additions and 1 deletions
src/go/plugin/go.d/modules/storcli
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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": {
|
||||
|
|
Loading…
Add table
Reference in a new issue