Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion collector/timex.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,15 @@ func (c *timexCollector) Update(ch chan<- prometheus.Metric) error {
divisor = microSeconds
}

offsetSec := float64(timex.Offset) / divisor
if offsetSec > 1.0 || offsetSec < -1.0 {
c.logger.Warn("Discarding unreasonable timex offset value",
"offset_seconds", offsetSec, "status", status)
offsetSec = 0
}

ch <- c.syncStatus.mustNewConstMetric(syncStatus)
ch <- c.offset.mustNewConstMetric(float64(timex.Offset) / divisor)
ch <- c.offset.mustNewConstMetric(offsetSec)
ch <- c.freq.mustNewConstMetric(1 + float64(timex.Freq)/ppm16frac)
ch <- c.maxerror.mustNewConstMetric(float64(timex.Maxerror) / microSeconds)
ch <- c.esterror.mustNewConstMetric(float64(timex.Esterror) / microSeconds)
Expand Down
4 changes: 4 additions & 0 deletions docs/node-mixin/alerts/alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,16 @@
expr: |||
(
node_timex_offset_seconds{%(nodeExporterSelector)s} > 0.05
and
node_timex_offset_seconds{%(nodeExporterSelector)s} < 1.0
and
deriv(node_timex_offset_seconds{%(nodeExporterSelector)s}[5m]) >= 0
)
or
(
node_timex_offset_seconds{%(nodeExporterSelector)s} < -0.05
and
node_timex_offset_seconds{%(nodeExporterSelector)s} > -1.0
and
deriv(node_timex_offset_seconds{%(nodeExporterSelector)s}[5m]) <= 0
)
Expand Down
Loading