[ZBXNEXT-9603] New built-in macros and functions for timestamp tracking Created: 2024 Nov 19  Updated: 2025 Feb 17  Resolved: 2025 Feb 17

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: None
Fix Version/s: 7.4.0alpha1

Type: New Feature Request Priority: Trivial
Reporter: Rostislav Palivoda Assignee: Sergejs Boidenko
Resolution: Fixed Votes: 1
Labels: Zabbix7.4
Remaining Estimate: Not Specified
Time Spent: 3h 25m
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates ZBXNEXT-2045 add trigger function that would retur... Closed
duplicates ZBXNEXT-1118 New macros for showing date and time ... Closed
Sub-task
depends on ZBXNEXT-2045 add trigger function that would retur... Closed
depends on ZBXNEXT-1118 New macros for showing date and time ... Closed
depends on ZBXNEXT-7017 Add built in macro {ITEM.TIME[0-9]} a... Closed
Team: Team A
Sprint: Prev.Sprint, S24-W50/51/52/1, S25-W2/3, S25-W4/5, S25-W6/7
Story Points: 3

 Description   

Introduce new built-in macros and history functions in order to enhance time-related tracking capabilities for item values.

  1. Add macros {ITEM.VALUE.DATE}, {ITEM.VALUE.TIME}, {ITEM.VALUE.TIMESTAMP}, {ITEM.VALUE.AGE}, {ITEM.LASTVALUE.DATE}, {ITEM.LASTVALUE.TIME}, {ITEM.LASTVALUE.TIMESTAMP}, {ITEM.LASTVALUE.AGE}
    1. {*.DATE} - the date (YYYYMMDD) when item value was collected
    2. {*.TIME} - the time (HHMMSS) when item value was collected
    3. {*.TIMESTAMP} - the unix timestamp when item value was collected
    4. {*.AGE} - the time elapsed in seconds since item value was collected until macro evaluation
    5. Support in contexts where {ITEM.VALUE} is supported
    6. Support numeric indexes <1-9> in the context of trigger expressions
  1. Add history functions:
    1. lastclock(/host/key, <#num<:time shift>>) - returns the timestamp of the Nth most recent item value
    2. logtimestamp(/host/key, <#num<:time shift>>) - returns the log message timestamp of the Nth most recent log item value
      1. calculation of time-shift is based on the item value clock, not on the log message timestamp
    3. firstclock(/host/key, sec<:time shift>) - returns the timestamp of the oldest item value within evaluation period
    4. Examples:
      1. lastclock(/host/key, #2) - returns the timestamp of the 2nd latest value
      2. logtimestamp(/host/key, #3:now-1d) - returns the log message timestamp of the 3rd latest value one day ago
      3. firstclock(/host/key, 30m) - returns the timestamp of the first value within 30m until now


 Comments   
Comment by Eliza Sekace [ 2025 Feb 06 ]

Available in 7.4.0alpha1 (master) 5e0ae16e2f9

Comment by Martins Valkovskis [ 2025 Feb 12 ]

Updated documentation:

Generated at Sun Apr 20 21:16:10 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.