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