Ad Widget

Collapse

Formula Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LukeAB93UK
    Member
    Zabbix Certified Specialist
    • Jun 2023
    • 72

    #1

    Formula Help

    Hello,

    So I have this formula "count(//icmpping[,,,,4000],7d,,"0")" which works wonders on a host, does exactly what I want it to do.

    Now I have another host where I put all my calculated items that apply to a group.

    I am trying to do this

    count(last_foreach(/*/icmpping[,,,,4000],7d,,"0"?[group="HOST GROUP HERE"]))

    But it is not working.

    This however does

    count(last_foreach(/*/icmpping[,,,,4000]?[group="HOST GROUP HERE"]))

    What I am trying to do is the total count across every host in my group that that item key has returned a value of 0 in 7 days instead of 1.

    Is there any way to do it I am a bit lost here.
  • markfree
    Senior Member
    • Apr 2019
    • 868

    #2
    So, first you have a simple check item that returns an ICMP response.
    Then, I guess you have a calculated item that counts how many responses are 0.
    It wasn't clear to me if this formula of your is actually a calculated item, but I'm assuming it is.

    Why are you counting the ICMP item instead of the count item?

    Anyway... By using "count(last_foreach...)" you are only counting the last value of your ICMP items in your group, not the amount of the last 7 days.

    You could try "count_foreach".
    Code:
    sum(count_foreach(/*/icmpping[,,,,4000]?[group="HOST GROUP HERE"],7d,"eq",0))

    Comment

    • LukeAB93UK
      Member
      Zabbix Certified Specialist
      • Jun 2023
      • 72

      #3
      Originally posted by markfree
      So, first you have a simple check item that returns an ICMP response.
      Then, I guess you have a calculated item that counts how many responses are 0.
      It wasn't clear to me if this formula of your is actually a calculated item, but I'm assuming it is.

      Why are you counting the ICMP item instead of the count item?

      Anyway... By using "count(last_foreach...)" you are only counting the last value of your ICMP items in your group, not the amount of the last 7 days.

      You could try "count_foreach".
      Code:
      sum(count_foreach(/*/icmpping[,,,,4000]?[group="HOST GROUP HERE"],7d,"eq",0))
      Hello,

      I am still getting my head around some of the formulas. I am just trying to count how many times that item key has returned 0 on all the hosts in my specified group in the last 7 days. The ICMP ping item checks once per minute so im essentially trying to get the outage minutes.

      I am currently doing it a diffrent way

      I have one aggregate calculation sum(last_foreach(/*/kpi.outage.time?[group="HOST GROUP"])) which adds up the value of that item which is this formula with the key "kpi.outage.time" = (count(//icmpping[,,,,4000],7d,,"0")) but I was wondering it it was possible to do it directly using the item key "icmpping[,,,,4000]" instead of having to have 2x calculated items basically. One to count it per host and then 1x to add all that up in a group which is what im doing now.

      I just tried the suggestion you provided but all I got was
      • Incorrect value for field "Formula": invalid number of parameters in function "count_foreach".
      Last edited by LukeAB93UK; 17-07-2024, 16:48.

      Comment

      Working...