summaryrefslogtreecommitdiffstats
path: root/collectors/timex.plugin
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2022-04-12 13:40:18 +0200
committerGitHub <noreply@github.com>2022-04-12 14:40:18 +0300
commita129b10e58fb40e1c4a6e32942954cff7fca1b84 (patch)
tree0ddc7c2d2eba23b0400c89b691e76b17549cd464 /collectors/timex.plugin
parentdd67a12d149d11a001dd7910477a7271f0ea7a78 (diff)
Show error when clock synchronization state is unavailable (#12667)
* Show error when clock synchronization state is unavailable * Update collectors/timex.plugin/plugin_timex.c Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud> * Update collectors/timex.plugin/plugin_timex.c Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
Diffstat (limited to 'collectors/timex.plugin')
-rw-r--r--collectors/timex.plugin/plugin_timex.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/collectors/timex.plugin/plugin_timex.c b/collectors/timex.plugin/plugin_timex.c
index b8d75e5733..34a3415a0b 100644
--- a/collectors/timex.plugin/plugin_timex.c
+++ b/collectors/timex.plugin/plugin_timex.c
@@ -67,8 +67,17 @@ void *timex_main(void *ptr)
struct timex timex_buf = {};
int sync_state = 0;
+ static int prev_sync_state = 0;
sync_state = ADJUST_TIMEX(&timex_buf);
+
+ int non_seq_failure = (sync_state == -1 && prev_sync_state != -1);
+ prev_sync_state = sync_state;
+
+ if (non_seq_failure) {
+ error("Cannot get clock synchronization state");
+ continue;
+ }
collected_number divisor = USEC_PER_MS;
if (timex_buf.status & STA_NANO)