*Really* use the right timezone when parsing timestamps.
This commit is contained in:
1 parent
21715e2dc3
commit
5518c1e316
1 file changed
+3
-2
+3
-2
@@ -176,14 +176,15 @@ func CollectClientStatusFromReader(statusPath string, file io.Reader, ch chan<-
|
|||||||
// Stats header.
|
// Stats header.
|
||||||
} else if fields[0] == "Updated" && len(fields) == 2 {
|
} else if fields[0] == "Updated" && len(fields) == 2 {
|
||||||
// Time at which the statistics were updated.
|
// Time at which the statistics were updated.
|
||||||
time, err := time.Parse("Mon Jan 2 15:04:05 2006", fields[1])
|
location, _ := time.LoadLocation("Local")
|
||||||
|
time, err := time.ParseInLocation("Mon Jan 2 15:04:05 2006", fields[1], location)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
openvpnStatusUpdateTimeDesc,
|
openvpnStatusUpdateTimeDesc,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(time.Local().Unix()),
|
float64(time.Unix()),
|
||||||
statusPath)
|
statusPath)
|
||||||
} else if desc, ok := openvpnClientDescs[fields[0]]; ok && len(fields) == 2 {
|
} else if desc, ok := openvpnClientDescs[fields[0]]; ok && len(fields) == 2 {
|
||||||
// Traffic counters.
|
// Traffic counters.
|
||||||
|
|||||||
Reference in new issue
Block a user