[ZBX-19924] Time shift functions in calculated items and triggers (invalid second parameter) Created: 2021 Sep 07  Updated: 2024 Apr 10  Resolved: 2021 Dec 13

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 5.4.3
Fix Version/s: 5.4.6rc1, 6.0.0alpha4, 6.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Yevhen Loha Assignee: Vladislavs Sokurenko
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File zbx1.png     PNG File zbx2.png     PNG File zbx3.png    
Issue Links:
Duplicate
is duplicated by ZBX-20274 Time shift definition for today is no... Closed
Team: Team A
Sprint: Sprint 80 (Sep 2021), Sprint 81 (Oct 2021), Sprint 82 (Nov 2021), Sprint 83 (Dec 2021)
Story Points: 0.25

 Description   

Looks like shift functions in calculated items and triggers are not working properly (see attached screens).

According to this and this we can use function sum(/host/key,time period<:time shift>) with time shift period of 1d:now/d+1d, i.e. sum(/host/key, 1d:now/d+1d) = 0. Instead Zabbix gives 'invalid second parameter' errors in items and triggers.

Here's text from /var/log/zabbix/zabbix_server.log

 34526:20210907:131613.563 item "Zabbix server:test1" became not supported:  Cannot evaluate function: invalid second parameter at "sum(/Zabbix server/net.if.in["ens18"],1d:now/d+1d)".
 34526:20210907:131714.645 item "Zabbix server:test2" became not supported: Cannot evaluate function: invalid second parameter at "min(/Zabbix server/net.if.in["ens18"],1d:now/d+1d)".
 34529:20210907:131815.727 item "Zabbix server:test3" became not supported: Cannot evaluate function: invalid second parameter at "max(/Zabbix server/net.if.in["ens18"],1d:now/d+1d)".
 34527:20210907:131816.730 item "Zabbix server:test4" became not supported: Cannot evaluate function: invalid second parameter at "avg(/Zabbix server/net.if.in["ens18"],1d:now/d+1d)".


 Comments   
Comment by Andrey Tocko (Inactive) [ 2021 Sep 15 ]

Hello and thank you for being observant.

now/d  = all current day

now/d - 1d = all previous day

now/d + 1d = all next day, but it is impossible because you need gathered data from future.

Looks like mistake in blog, there should be now/d

vso The documentation is correct. The problem is in the validation of the second parameter of trigger functions. This will be fixed in this ticket.

Comment by Yevhen Loha [ 2021 Sep 18 ]

OK, what about these ones?

Parameter Description
1d:now/d Yesterday
1d:now/d+1d Today
2d:now/d+1d Last 2 days
1w:now/w Last week
1w:now/w+1w This week

Mistakes too?

Comment by Vladislavs Sokurenko [ 2021 Sep 20 ]

Documentation must be fixed

<sasha> The documentation is correct. The problem is in the validation of the second parameter of trigger functions. This will be fixed in this ticket.

Comment by Vladislavs Sokurenko [ 2021 Nov 26 ]

Fixed in development branch feature/ZBX-19924-5.4

Comment by Vladislavs Sokurenko [ 2021 Dec 01 ]

Fixed in:

Generated at Sat May 24 08:10:08 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.