last() search too deep in history if item has no values but used in trigger expression

XMLWordPrintable

    • Type: Problem report
    • Resolution: Unresolved
    • Priority: Major
    • 8.0.0alpha2 (master)
    • Affects Version/s: 7.0.21, 7.4.5, 8.0.0alpha1
    • Component/s: Server (S)
    • None
    • Support backlog

      Steps:
      Create host as zbx_export_hosts_last.yaml
      There is such trigger (timer should also have such problem)

      last(/Zabbix server/trap[0])=0 or last(/Zabbix server/trap[1])=0
      

      Send value for /Zabbix server/trap[0].
      Restart Zabbix server.
      Send value for /Zabbix server/trap[0].
      Notice many queries as following after each restart that search in 1 month old history when value for /Zabbix server/trap[0] is sent.

      1515057:20251217:175936.939 In zbx_history_get_values() itemid:69106 value_type:3 start:0 count:2 end:1765987176
      1515057:20251217:175936.940 query [txnlev:1] [select clock,ns,value from history_uint where itemid=69106 and clock<=1765987176 and clock>1765983576 order by clock desc limit 2]
      1515057:20251217:175936.941 query [txnlev:1] [select clock,ns,value from history_uint where itemid=69106 and clock<=1765983576 and clock>1765940376 order by clock desc limit 2]
      1515057:20251217:175936.942 query [txnlev:1] [select clock,ns,value from history_uint where itemid=69106 and clock<=1765940376 and clock>1765853976 order by clock desc limit 2]
      1515057:20251217:175936.942 query [txnlev:1] [select clock,ns,value from history_uint where itemid=69106 and clock<=1765853976 and clock>1765767576 order by clock desc limit 2]
      1515057:20251217:175936.943 query [txnlev:1] [select clock,ns,value from history_uint where itemid=69106 and clock<=1765767576 and clock>1765162776 order by clock desc limit 2]
      1515057:20251217:175936.946 query [txnlev:1] [select clock,ns,value from history_uint where itemid=69106 and clock<=1765162776 and clock>1763308776 order by clock desc limit 2]
      1515057:20251217:175936.947 query [txnlev:1] [select clock,ns,value from history_uint where itemid=69106 and clock<=1762570776 order by clock desc limit 2]
      

      Expected:
      There should be a way to limit last function by time.

            Assignee:
            Zabbix Development Team
            Reporter:
            Vladislavs Sokurenko
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: