[ZBXNEXT-1719] Allow to use temporal trigger functions without item context Created: 2013 Apr 23  Updated: 2021 May 17  Resolved: 2021 May 17

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F), Server (S)
Affects Version/s: 2.0.5
Fix Version/s: None

Type: Change Request Priority: Trivial
Reporter: Volker Fröhlich Assignee: Unassigned
Resolution: Duplicate Votes: 14
Labels: expressions, simplification, syntax, trigger
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBXNEXT-2205 Ability to add a time or dayofweek co... Closed
is duplicated by ZBXNEXT-3486 new function for triggers - absolute(... Closed
is duplicated by ZBXNEXT-3688 New global macro/function for current... Closed
is duplicated by ZBXNEXT-5014 Get rid of unusable item key text in ... Closed
is duplicated by ZBX-6756 Epoch time function now() causes even... Closed

 Description   

Trigger functions always require an item to attach to. In the case of time(), this bloats the expression, while actually there is no connection to the item at all:

{host:item.time(0)} > 010000 & {host:item.time(0)} < 020000
time() > 010000 & time() < 020000

On the other hand, that would allow for trigger expressions without an item reference at all. I suppose that'd break everything.



 Comments   
Comment by richlv [ 2013 Apr 23 ]

i thought there was an issue about this already, but i can't find it.

in any case, validation would simply check that at least one item is referenced and not allow saving triggers if not.

it would be similar how one could try to create a trigger that would only include a user macro.

Comment by Oleksii Zagorskyi [ 2013 Jul 02 ]

Probably richlv meant ZBXNEXT-1791 which contains related discussion.
I'm not sure who is duplicate

<richlv> no, the discussion i had in mind was a couple years old at least

Comment by Marc [ 2014 Mar 15 ]

When considered for implementation (what I appreciate) keep in mind value resolution by macros (e.g. {ITEM.VALUE<1-9>})
There should still be the possibility to resolve the corresponding value in trigger names etc.

Comment by Raymond Kuiper [ 2014 Sep 19 ]

Kind of related: ZBXNEXT-2469

Comment by richlv [ 2017 Feb 08 ]

ZBXNEXT-3688 suggests using global macros for time(), now() and other such functions

Comment by Евланов Александр Викторович [ 2019 Feb 07 ]

>it would be similar how one could try to create a trigger that would only include a user macro.

Such trigger (based on now() or time(), for example) can exists and can be potentially useful. All problems lying on the database level where each trigger must be connected to some item. 
I think that now() (for example) is _really_ based on not-defined-yet item, but this item is in the zabbix_internal items set: it is something like zabbix[time,unix_ts].

Comment by Alexei Vladishev [ 2021 May 17 ]

It has been implemented in Zabbix 5.4. Now you can use time and date functions without references to any item, see https://www.zabbix.com/documentation/5.4/manual/appendix/functions/time

Generated at Fri Apr 26 05:43:18 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.