Skip to content

Commit

Permalink
iis: fix panic
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Dec 22, 2024
1 parent a9f8b3b commit f588ab9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion internal/collector/iis/iis_w3svc_w3wp.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (c *Collector) collectW3SVCW3WP(ch chan<- prometheus.Metric) error {
}

func (c *Collector) collectW3SVCW3WPv8(ch chan<- prometheus.Metric) error {
err := c.w3SVCW3WPPerfDataCollector.Collect(&c.perfDataObjectW3SVCW3WPV8)
err := c.w3SVCW3WPPerfDataCollectorV8.Collect(&c.perfDataObjectW3SVCW3WPV8)
if err != nil {
return fmt.Errorf("failed to collect APP_POOL_WAS metrics: %w", err)
}
Expand Down
14 changes: 7 additions & 7 deletions internal/collector/vmware/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package vmware

type perfDataCounterValuesCPU struct {
CouEffectiveVMSpeedMHz float64 `perfdata:"Effective VM Speed in MHz"` // \VM Processor(*)\Effective VM Speed in MHz
CpuHostProcessorSpeedMHz float64 `perfdata:"Host processor speed in MHz"` // \VM Processor(*)\Host processor speed in MHz
CpuLimitMHz float64 `perfdata:"Limit in MHz"` // \VM Processor(*)\Limit in MHz
CpuReservationMHz float64 `perfdata:"Reservation in MHz"` // \VM Processor(*)\Reservation in MHz
CpuShares float64 `perfdata:"Shares"` // \VM Processor(*)\Shares
CpuStolenMs float64 `perfdata:"CPU stolen time"` // \VM Processor(*)\CPU stolen time
CpuTimePercents float64 `perfdata:"% Processor Time"` // \VM Processor(*)\% Processor Time
CPUEffectiveVMSpeedMHz float64 `perfdata:"Effective VM Speed in MHz"` // \VM Processor(*)\Effective VM Speed in MHz
CPUHostProcessorSpeedMHz float64 `perfdata:"Host processor speed in MHz"` // \VM Processor(*)\Host processor speed in MHz
CPULimitMHz float64 `perfdata:"Limit in MHz"` // \VM Processor(*)\Limit in MHz
CPUReservationMHz float64 `perfdata:"Reservation in MHz"` // \VM Processor(*)\Reservation in MHz
CPUShares float64 `perfdata:"Shares"` // \VM Processor(*)\Shares
CPUStolenMs float64 `perfdata:"CPU stolen time"` // \VM Processor(*)\CPU stolen time
CPUTimePercents float64 `perfdata:"% Processor Time"` // \VM Processor(*)\% Processor Time
}

type perfDataCounterValuesMemory struct {
Expand Down
14 changes: 7 additions & 7 deletions internal/collector/vmware/vmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,43 +330,43 @@ func (c *Collector) collectCpu(ch chan<- prometheus.Metric) error {
ch <- prometheus.MustNewConstMetric(
c.cpuLimitMHz,
prometheus.GaugeValue,
c.perfDataObjectCPU[0].CpuLimitMHz,
c.perfDataObjectCPU[0].CPULimitMHz,
)

ch <- prometheus.MustNewConstMetric(
c.cpuReservationMHz,
prometheus.GaugeValue,
c.perfDataObjectCPU[0].CpuReservationMHz,
c.perfDataObjectCPU[0].CPUReservationMHz,
)

ch <- prometheus.MustNewConstMetric(
c.cpuShares,
prometheus.GaugeValue,
c.perfDataObjectCPU[0].CpuShares,
c.perfDataObjectCPU[0].CPUShares,
)

ch <- prometheus.MustNewConstMetric(
c.cpuStolenTotal,
prometheus.CounterValue,
utils.MilliSecToSec(c.perfDataObjectCPU[0].CpuStolenMs),
utils.MilliSecToSec(c.perfDataObjectCPU[0].CPUStolenMs),
)

ch <- prometheus.MustNewConstMetric(
c.cpuTimeTotal,
prometheus.CounterValue,
utils.MilliSecToSec(c.perfDataObjectCPU[0].CpuTimePercents),
utils.MilliSecToSec(c.perfDataObjectCPU[0].CPUTimePercents),
)

ch <- prometheus.MustNewConstMetric(
c.cpuEffectiveVMSpeedMHz,
prometheus.GaugeValue,
c.perfDataObjectCPU[0].CouEffectiveVMSpeedMHz,
c.perfDataObjectCPU[0].CPUEffectiveVMSpeedMHz,
)

ch <- prometheus.MustNewConstMetric(
c.hostProcessorSpeedMHz,
prometheus.GaugeValue,
c.perfDataObjectCPU[0].CpuHostProcessorSpeedMHz,
c.perfDataObjectCPU[0].CPUHostProcessorSpeedMHz,
)

return nil
Expand Down

0 comments on commit f588ab9

Please sign in to comment.