mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-15 09:26:36 +00:00
Convert os time and timezone from WMI to native go
Signed-off-by: Ben Ridley <benridley29@gmail.com>
This commit is contained in:
@@ -171,15 +171,15 @@ func (c *OSCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, er
|
|||||||
float64(dst[0].FreePhysicalMemory*1024), // KiB -> bytes
|
float64(dst[0].FreePhysicalMemory*1024), // KiB -> bytes
|
||||||
)
|
)
|
||||||
|
|
||||||
time := dst[0].LocalDateTime
|
currentTime := time.Now()
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.Time,
|
c.Time,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(time.Unix()),
|
float64(currentTime.Unix()),
|
||||||
)
|
)
|
||||||
|
|
||||||
timezoneName, _ := time.Zone()
|
timezoneName, _ := currentTime.Zone()
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.Timezone,
|
c.Timezone,
|
||||||
|
|||||||
Reference in New Issue
Block a user