Ad Widget

Collapse

Trouble understanding count function

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sscheib
    Junior Member
    • Dec 2019
    • 11

    #1

    Trouble understanding count function

    All,

    I am trying to make use of the count function in my trigger definitions.
    My understanding of this function is, that it will take last N values (depending whether the count is defined as a number of retrieved values or a time frame) and compare all of these values against the condition defined in the trigger.
    So I have defined the following trigger expression:
    Code:
    count(/Template App Netatmo Weather/netatmo.weather.namodule4.rf_status[{#STATION_NAME},{#MODULE_NAME}],#48,"ge",90)
    My understanding of the trigger is as follows:
    - If *all* of the last 48 retrieved values are greater or equal to 90, the trigger will fire

    Accordingly I have defined the following recovery expression for that trigger:
    Code:
    count(/Template App Netatmo Weather/netatmo.weather.namodule4.rf_status[{#STATION_NAME},{#MODULE_NAME}],#6,"lt",90)
    Again, my understanding:
    - If all of the last 6 retrieved values are less than 90, the trigger will recover

    Is this assumption correct or am I totally missing the point?

    The trigger fires already after a few (e.g. 2 or 3) values are greater or equal than 90 and will take a very long time (e.g. half a day) to recover, while I provide new values every 5 minutes.

    Could somebody provide any hints what I might do wrong here?

    For reference, I use the latest Zabbix 6.0 release.

    Thanks, and all the best,
    Steffen


  • Answer selected by sscheib at 27-01-2023, 18:59.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    count receives the number of values that matches your criteria... ie..
    count(/Template App Netatmo Weather/netatmo.weather.namodule4.rf_status[{#STATION_NAME},{#MODULE_NAME}],#48,"ge",90)
    returns number of values that are greater or equal to 90 in last 48 values... So, if you want to use that in trigger, you should add equation there..
    count(/Template App Netatmo Weather/netatmo.weather.namodule4.rf_status[{#STATION_NAME},{#MODULE_NAME}],#48,"ge",90)=48
    Then all those values have to match your criteria (ge 90) for the trigger to fire..

    Recovery expression is additional criteria for trigger to become false... so at first your main trigger expression has to become false and then recovery expression must become true for that whole trigger to become false... And again, you are missing the number to match it against..

    Comment

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

      #2
      count receives the number of values that matches your criteria... ie..
      count(/Template App Netatmo Weather/netatmo.weather.namodule4.rf_status[{#STATION_NAME},{#MODULE_NAME}],#48,"ge",90)
      returns number of values that are greater or equal to 90 in last 48 values... So, if you want to use that in trigger, you should add equation there..
      count(/Template App Netatmo Weather/netatmo.weather.namodule4.rf_status[{#STATION_NAME},{#MODULE_NAME}],#48,"ge",90)=48
      Then all those values have to match your criteria (ge 90) for the trigger to fire..

      Recovery expression is additional criteria for trigger to become false... so at first your main trigger expression has to become false and then recovery expression must become true for that whole trigger to become false... And again, you are missing the number to match it against..

      Comment

      • sscheib
        Junior Member
        • Dec 2019
        • 11

        #3
        Fantastic! Now that you told me what it should look like it is so obvious, but I couldn't figure that out myself.
        Thanks a lot!!

        Comment

        Working...