- Removed HighPrecisionTemperature property and just mapped it to Temperature
- Converted decikelvin to Celsius - Added a loop to get the values from each zone - Added documentation for percent passive limit and throttle reasons
This commit is contained in:
parent
1a67ca54b6
commit
47656b16bd
|
@ -12,38 +12,37 @@ func init() {
|
||||||
|
|
||||||
// A ThermalZoneCollector is a Prometheus collector for WMI Win32_PerfRawData_Counters_ThermalZoneInformation metrics
|
// A ThermalZoneCollector is a Prometheus collector for WMI Win32_PerfRawData_Counters_ThermalZoneInformation metrics
|
||||||
type ThermalZoneCollector struct {
|
type ThermalZoneCollector struct {
|
||||||
HighPrecisionTemperature *prometheus.Desc
|
PercentPassiveLimit *prometheus.Desc
|
||||||
PercentPassiveLimit *prometheus.Desc
|
Temperature *prometheus.Desc
|
||||||
Temperature *prometheus.Desc
|
ThrottleReasons *prometheus.Desc
|
||||||
ThrottleReasons *prometheus.Desc
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewThermalZoneCollector ...
|
// NewThermalZoneCollector ...
|
||||||
func NewThermalZoneCollector() (Collector, error) {
|
func NewThermalZoneCollector() (Collector, error) {
|
||||||
const subsystem = "thermalzone"
|
const subsystem = "thermalzone"
|
||||||
return &ThermalZoneCollector{
|
return &ThermalZoneCollector{
|
||||||
HighPrecisionTemperature: prometheus.NewDesc(
|
Temperature: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "high_precision_temperature"),
|
prometheus.BuildFQName(Namespace, subsystem, "temperature_celsius"),
|
||||||
"(HighPrecisionTemperature)",
|
"(Temperature)",
|
||||||
nil,
|
[]string{
|
||||||
|
"Name",
|
||||||
|
},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
PercentPassiveLimit: prometheus.NewDesc(
|
PercentPassiveLimit: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "percent_passive_limit"),
|
prometheus.BuildFQName(Namespace, subsystem, "percent_passive_limit"),
|
||||||
"(PercentPassiveLimit)",
|
"(PercentPassiveLimit)",
|
||||||
nil,
|
[]string{
|
||||||
nil,
|
"Name",
|
||||||
),
|
},
|
||||||
Temperature: prometheus.NewDesc(
|
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "temperature"),
|
|
||||||
"(Temperature)",
|
|
||||||
nil,
|
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
ThrottleReasons: prometheus.NewDesc(
|
ThrottleReasons: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "throttle_reasons"),
|
prometheus.BuildFQName(Namespace, subsystem, "throttle_reasons"),
|
||||||
"(ThrottleReasons)",
|
"(ThrottleReasons)",
|
||||||
nil,
|
[]string{
|
||||||
|
"Name",
|
||||||
|
},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -60,13 +59,12 @@ func (c *ThermalZoneCollector) Collect(ch chan<- prometheus.Metric) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Win32_PerfRawData_Counters_ThermalZoneInformation docs:
|
// Win32_PerfRawData_Counters_ThermalZoneInformation docs:
|
||||||
// - <add link to documentation here>
|
// https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_thermalzoneinformation/
|
||||||
type Win32_PerfRawData_Counters_ThermalZoneInformation struct {
|
type Win32_PerfRawData_Counters_ThermalZoneInformation struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
HighPrecisionTemperature uint32
|
HighPrecisionTemperature uint32
|
||||||
PercentPassiveLimit uint32
|
PercentPassiveLimit uint32
|
||||||
Temperature uint32
|
|
||||||
ThrottleReasons uint32
|
ThrottleReasons uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,29 +75,29 @@ func (c *ThermalZoneCollector) collect(ch chan<- prometheus.Metric) (*prometheus
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
for _, info := range dst {
|
||||||
c.HighPrecisionTemperature,
|
//Divide by 10 and subtract 273.15 to convert decikelvin to celsius
|
||||||
prometheus.GaugeValue,
|
ch <- prometheus.MustNewConstMetric(
|
||||||
float64(dst[0].HighPrecisionTemperature),
|
c.Temperature,
|
||||||
)
|
prometheus.GaugeValue,
|
||||||
|
(float64(info.HighPrecisionTemperature)/10.0)-273.15,
|
||||||
|
info.Name,
|
||||||
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.PercentPassiveLimit,
|
c.PercentPassiveLimit,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(dst[0].PercentPassiveLimit),
|
float64(info.PercentPassiveLimit),
|
||||||
)
|
info.Name,
|
||||||
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.Temperature,
|
c.ThrottleReasons,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(dst[0].Temperature),
|
float64(info.ThrottleReasons),
|
||||||
)
|
info.Name,
|
||||||
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
}
|
||||||
c.ThrottleReasons,
|
|
||||||
prometheus.GaugeValue,
|
|
||||||
float64(dst[0].ThrottleReasons),
|
|
||||||
)
|
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,11 @@ None
|
||||||
|
|
||||||
Name | Description | Type | Labels
|
Name | Description | Type | Labels
|
||||||
-----|-------------|------|-------
|
-----|-------------|------|-------
|
||||||
`wmi_thermalzone_high_precision_temperature` | _Not yet documented_ | gauge | None
|
`wmi_thermalzone_percent_passive_limit` | % Passive Limit is the current limit this thermal zone is placing on the devices it controls. A limit of 100% indicates the devices are unconstrained. A limit of 0% indicates the devices are fully constrained. | gauge | None
|
||||||
`wmi_thermalzone_percent_passive_limit` | _Not yet documented_ | gauge | None
|
`wmi_thermalzone_temperature_celsius ` | Temperature of the thermal zone, in degrees Celsius. | gauge | None
|
||||||
`wmi_thermalzone_temperature ` | _Not yet documented_ | gauge | None
|
`wmi_thermalzone_throttle_reasons ` | Throttle Reasons indicate reasons why the thermal zone is limiting performance of the devices it controls. 0x0 – The zone is not throttled. 0x1 – The zone is throttled for thermal reasons. 0x2 – The zone is throttled to limit electrical current. | gauge | None
|
||||||
`wmi_thermalzone_throttle_reasons ` | _Not yet documented_ | gauge | None
|
|
||||||
|
[`Throttle reasons` source](https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/examples--requirements-and-diagnostics)
|
||||||
|
|
||||||
### Example metric
|
### Example metric
|
||||||
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
_This collector does not yet have explained examples, we would appreciate your help adding them!_
|
||||||
|
|
Loading…
Reference in New Issue