Ad Widget

Collapse

Incorrect item values due to host unavailability

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nikl15
    Junior Member
    • Feb 2017
    • 16

    #1

    Incorrect item values due to host unavailability

    Good afternoon! Let me clarify something. There is a host with a calculated item that retrieves values from the item values of other hosts.
    sum(last(/test1/net.if.speed[ifHighSpeed.2741]), last(/test2/net.if.speed[ifHighSpeed.10962]), last(/test1/net.if.speed[ifHighSpeed.7268]), last(/test2/net.if.speed[ifHighSpeed.10982]))
    This calculated item sums up the bandwidth of several ports and shows the total. Usually, it displays 350 Gbps. However, today the host test1 was unavailable for an hour, and the bandwidth dropped to 330 Gbps, whereas it should have been 250 Gbps because test1 contributes 100 Gbps across two interfaces.

    I assume Zabbix used some cached values from the device when it was still accessible. Is there a way to make Zabbix substitute 0 in the case of the host being unavailable (i.e., when the item's values are not being received)?
  • kyus
    Senior Member
    • Feb 2024
    • 172

    #2
    Hey!

    Since you are using function "last", Zabbix is taking the last value recorded on the history for this device, that's most likely why the total value didn't drop as much as expected.

    I would suggest using a time shift in your "last" function, so it would stop using history values after the device is unavailable for the specified time.

    Code:
    last(/host/key,<#num<:time shift>>)

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #3
      Originally posted by kyus
      I would suggest using a time shift in your "last" function, so it would stop using history values after the device is unavailable for the specified time.
      How time shift will stop this? It just moves calculation back in time and then its down longer than your time shift and you get to the "no values" timezone again? This not really what OP needs (calculation of bandwidth NOW).

      If item value cannot be polled, then item usually becomes "not supperted", you can enable preprocessing "check for not supported value" and set value to 0.

      Comment


      • kyus
        kyus commented
        Editing a comment
        My idea was that after x time without data collection from the device it would stop being used in the calculation (overcomplicated it), I didn't test it. But yeah, your solution makes way more sense and it's more reliable
    • nikl15
      Junior Member
      • Feb 2017
      • 16

      #4
      my solution:

      last(/test1/net.if.speed[ifHighSpeed.2741]) * (count(/test1/net.if.speed[ifHighSpeed.2741], 12m) > 0) +
      last(/test1-2/net.if.speed[ifHighSpeed.10962]) * (count(/test1-2/net.if.speed[ifHighSpeed.10962], 12m) > 0) +
      last(/test1/net.if.speed[ifHighSpeed.7268]) * (count(/test1/net.if.speed[ifHighSpeed.7268], 12m) > 0) +
      last(/test1-2/net.if.speed[ifHighSpeed.10982]) * (count(/test1-2/net.if.speed[ifHighSpeed.10982], 12m) > 0)

      Comment

      Working...