Ad Widget

Collapse

Help with trigger expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • svsjmallory
    Junior Member
    • Apr 2022
    • 2

    #1

    Help with trigger expression

    Hello,

    I'm on zabbix 5.4. I have an issue with a custom trigger I've configured. The item being checked returns nothing if everything is ok. If there is a problem, then it returns data. I'd like the trigger to go off only if there's been a problem for more than five minutes. I've the expression below, but it's still going off on a single check of the service.

    min(bitlength(last(/Docker Swarm/docker.services-crit)),5m)>1


    Obviously, I'm not doing something right. What should I change?
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Currently your expression is based on just last value, it really does not consider age, as that 5m, what you define there (min(.., 5m)), means "within last 5 minutes". So, of course it will fire right away, when data comes in.

    you could try with
    count (/host/key,(sec|#num)<:time shift>,<operator>,<pattern>)
    count(/Docker Swarm/docker.services-crit),5m)>=5

    If you do not have 5 values during last 5 minutes, then it should not fire...

    Comment

    • svsjmallory
      Junior Member
      • Apr 2022
      • 2

      #3
      Thanks. I tried the syntax you provided above, and it throws an alert immediately. I think maybe because the item itself returns a string, and count doesn't handle that. That's why I've been using the bitlength function.

      Comment

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

        #4
        Count can handle all kind of data. It really does not count, what are you counting..
        Supported value types: float, integer, string, text, log

        But thinking of this.. recalculation takes place, when new values arrive, so if nothing will come in it will not be recalculated and trigger stays active ...

        I think your best option would still be to return something every time check runs.

        Comment

        Working...