[ZBX-24696]  Zabbix Agent Active: Trigger "System time is out of sync" is not working! Created: 2024 Jun 20  Updated: 2024 Jul 16  Resolved: 2024 Jun 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G), Templates (T)
Affects Version/s: None
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Andrea Marconi Assignee: Alexander Vladishev
Resolution: Won't Do Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 22.04



 Description   

Good morning everyone. I would like to raise a case:

  • Zabbix Server installed on Ubuntu 22.04 with Postgresql as DB (Zabbix version 6.4.5)
  • Official Zabbix active agent template for Linux
  • Item: System local time (system.localtime) of active type
  • Trigger: “System time is out of sync” that uses fuzzytime

I had a serious problem on a server with the time monitored through an installed and working active agent (6.4): I was not notified about the wrong system time of the Linux server.
I know fuzzytime's function (immediately checked the time on the server, db, fe, be, correctly synchronized with the NTP server) and the trigger.

There is a problem: fuzzytime only works with passive checks!
Using the active Zabbix Agent and the related template, the item "System local time" is a Zabbix active checks

How can we solve this in case an active agent is used to have a working trigger comparable to the passive one “System time is out of sync”?

Thank you,
Best Regard.



 Comments   
Comment by Dimitri Bellini [ 2024 Jun 20 ]

Hi ZabbixDev Teams,
currently (Zabbix 7.0) in the official templates "Linux by Zabbix agent active" and "Windows by Zabbix agent active" have trigger which is using the "fuzzytime" function but as I know, but maybe I'm wrong, this function it's not working as expeted using "Active Checks". It's corect?
Can you give us feedback?
Thanks

Comment by Denis Rasikhov [ 2024 Jun 28 ]

Hello! Yes, the fuzzytime() function will only work correctly with passive checks, as stated in documentation. Because of how it works: it compares the value (timestamp) with the timestamp of retrieval of that value. And in case with active agent, since it's the agent that creates the timestamp of the value retrieval, both timestamps will always be the same and even if the agent host time is not in sync, the trigger will never fire.

The trigger for active templates was most likely added by mistake and has been removed in ZBXNEXT-6445.

If you really need such trigger for active agents, you could come up with something like this:

1. Create dependent item from the "System local time" item, which will store the actual time difference.
2. Use JS preprocessing in this item to get the current time and calculate the difference, for example:

return Math.abs(Math.floor(Date.now()/1000 - value)); 

3. Create a trigger for this metric, for example:

min(/template/time.diff,5m)>{$SYSTEM.FUZZYTIME.MAX} 

Although, after discussing the possible solution with the DEV team, it was decided to leave the fuzzytime trigger only in passive agent templates and avoid using such workarounds.

Comment by Dimitri Bellini [ 2024 Jun 28 ]

Hi Denis,
thanks so much for the reply and thanks for the possible workaround.

However, the decision to remove the trigger from the Zabbix Agent Active template, for me, it's not correct.

For me, Zabbix must provide a "good User Experience" without such inconsistency between templates.

Please leave the Trigger, maybe using the proposed workaround.

Thanks so much

Comment by Alex Kalimulin [ 2024 Jul 16 ]

dimitri.bellini, the proposed workaround will work in many cases but not in all. Specifically, if the data send is delayed by some reason one can get very confusing false positives.

Comment by Dimitri Bellini [ 2024 Jul 16 ]

Kalimulin Thank you for the reply and I can understand it "but" this Trigger it's very helpful and provide a fast feedback on "Not sync Time".
If you can't use the workaround we still need a viable option for Zabbix Agent Active, please try to think about it.

Thanks so much & Good work!

Generated at Mon May 12 06:32:17 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.