[ZBX-17115] nodata function doesn't work different time for Server and Agent Created: 2019 Dec 23  Updated: 2024 Apr 10  Resolved: 2020 Jan 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Documentation (D)
Affects Version/s: None
Fix Version/s: 5.0 (plan)

Type: Documentation task Priority: Trivial
Reporter: Keita Higa Assignee: Martins Valkovskis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ZabbixServer 4.0.11 , 4.0.16
ZabbixAgent 4.0.11 , 4.0.16


Team: Team D
Sprint: Sprint 59 (Dec 2019), Sprint 60 (Jan 2020)

 Description   

Case:
Time difference between ZabbixServer and ZabbixAgent
This case, triggers doesn't firing nodata function.

Steps to reproduce:
Envriment:
ZabbixServer 4.0.16 and 4.0.11
ZabbixAgent 4.0.16 and 4.0.11 (Time is set 10 minutes ago than ZabbixServer)

ItemSample:
Itemkey log[/tmp/sample.log] 
Interval 1sec

TriggerSample:
log[/tmp/sample.log].nodata(60)}=0

SQL:

+--------+------------+-----------+--------+----------+------------------------------+------------+-----------+
| itemid | clock      | timestamp | source | severity | value                        | logeventid | ns        |
+--------+------------+-----------+--------+----------+------------------------------+------------+-----------+
|  28512 | 1577070641 |         0 |        |        0 | Sun Dec 22 22:10:41 EST 2019 |          0 |  81929799 |
|  28512 | 1577070737 |         0 |        |        0 | Sun Dec 22 22:12:16 EST 2019 |          0 | 122892444 |
|  28512 | 1577070908 |         0 |        |        0 | Sun Dec 22 22:15:07 EST 2019 |          0 | 202081283 |
+--------+------------+-----------+--------+----------+------------------------------+------------+-----------+

Logs:

  4109:20191222:222550.496 trapper got '{"request":"agent data","session":"eb605b9007bbb9f86a6c7ffe730c049d","data":[{"host":"debug-agent","key":"log[/tmp/sample.log]","value":"Sun Dec 22 22:15:07 EST 2019","lastlogsize":232,"id":5,"clock":1577070908,"ns":202081283}],"clock":1577070908,"ns":202711349}'

  4090:20191222:222551.371 query [txnlev:1] [insert into history_log (itemid,clock,ns,timestamp,source,severity,value,logeventid) values (28512,1577070908,202081283,0,'',0,'Sun Dec 22 22:15:07 EST 2019',0);]

  4090:20191222:222551.380 In zbx_evaluate_item_functions() funcs_num:1
  4090:20191222:222551.380 In evaluate_function() function:'debug-agent:log[/tmp/sample.log].nodata(60)'
  4090:20191222:222551.380 In evaluate_NODATA()
  4090:20191222:222551.380 In get_function_parameter_int() parameters:'60' Nparam:1
  4090:20191222:222551.380 In substitute_simple_macros() data:'60'
  4090:20191222:222551.380 get_function_parameter_int() type:sec value:60
  4090:20191222:222551.381 End of get_function_parameter_int():SUCCEED
  4090:20191222:222551.381 In zbx_vc_get_values() itemid:28512 value_type:2 seconds:60 count:1 sec:1577071551 ns:381038586
  4090:20191222:222551.381 End of zbx_vc_get_values():SUCCEED count:0 cached:1
  4090:20191222:222551.381 End of evaluate_NODATA():SUCCEED
  4090:20191222:222551.381 End of evaluate_function():SUCCEED value:'1'
  4090:20191222:222551.381 End of zbx_evaluate_item_functions()

For instance:
Occurs when NTP is out of sync.

Result:
log[/tmp/sample.log].nodata(60)}=0 doesn't work

Expected:
nodata trigger work



 Comments   
Comment by Andrejs Tumilovics [ 2019 Dec 27 ]

kt_eng06 I'm trying to understand the use case.
So, if we have

{Host:log[/tmp/sample.log].nodata(60)}=0

trigger expression, trigger would switch to PROBLEM state just once a new log message appear and go back to OK after 60 seconds.
We can get similar results with below trigger expression

{Host:log[/tmp/sample.log].strlen()}>0

This could be then used for actions.
Problem might be resolved manually.

nodata() does not work in your scenario because log[] metrics are active checks, so they are stored in DB with agent's timestamp. But, trigger functions are evaluated on server. If server and agent hosts are not synchronized, time-related trigger functions might work incorrectly.

I'm going to close the ticket as "Won't fix" based on time synchronization requirements

Comment by Glebs Ivanovskis [ 2020 Jan 28 ]

Something was documented as a result of this ticket, but no one outside Zabbix knows what exactly.

Comment by Martins Valkovskis [ 2020 Jan 28 ]

The following text has been added to 4.0, 4.4, 5.0 documentation of nodata():

This function may not work properly if there are time differences between Zabbix server, proxy and agent.

Comment by Glebs Ivanovskis [ 2020 Jan 28 ]

Thank you, martins-v! Consider also adding time synchronization requirement link.

Comment by Martins Valkovskis [ 2020 Jan 28 ]

Thanks, added.

Comment by Glebs Ivanovskis [ 2020 Jan 28 ]

Great!

Generated at Sat Aug 02 10:25:41 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.