Ad Widget

Collapse

Trigger with time range

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luissuez
    Junior Member
    • Sep 2018
    • 11

    #1

    Trigger with time range

    Hello everybody

    I'm new with Zabbix and I have a little issue. I set ODBC in order to create som sql query. Those query check some value and the result is triggered if wrong. All fine. But now I have a new check to set that I only can check between 14h00 and 15h00.
    So, acordng to some posts I use this sintaxe in my trigger:

    {Zabbix server:db.odbc.select[GesIntel,ESTTEL].last()}>0

    This trigger works but I need to add the tiem range.
    I try like this:

    {Zabbix server:db.odbc.select[GesIntel,ESTTEL].last()}>0 & ({Zabbix serverroc.num[ntpd].time(0)}<153000 | {Zabbix serverroc.num[ntpd].time(0)}>140000)

    This sintaxe is wrong because I have a sintaxe error... Someone can help me
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    Look on "time" function on https://www.zabbix.com/documentation...gers/functions
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • luissuez
      Junior Member
      • Sep 2018
      • 11

      #3
      Hi , thanks for the help... But I'm not able to resolve this with this link, Could you please post an exemple to get my trigger with a time range?
      Thanks in advance

      Comment

      • Anth(0)ny
        Member
        • Jul 2015
        • 42

        #4
        expression with additional time range from 1 to 2 hours

        ... and ({....time()}>010000 and {....time()}<020000)

        Comment

        • luissuez
          Junior Member
          • Sep 2018
          • 11

          #5
          Hello
          ok, so I try this code in the trigger:

          Code:
          {Zabbix server:db.odbc.select[GesIntel,ESTTEL].last()}>0
          and ({Zabbix server:db.odbc.select[GesIntel,ESTTEL].time()}>010000)
          and ({Zabbix server:db.odbc.select[GesIntel,ESTTEL].time()}<030000)
          but, it fails..
          The error is:

          [CODE]Incorrect trigger expression. Check expression part starting from "0 and ({Zabbix server:db.odbc.select[GesIntel,ESTTEL].time()}>010000) and ({Zabbix server:db.odbc.select[GesIntel,ESTTEL].time()}<030000)"[\CODE]

          Thanks a lot

          Comment

          • zux
            Member
            • Sep 2018
            • 93

            #6
            I think you have some syntax errors there. This one works for me:
            {Zabbix server:system.cpu.load[].last()}>0.5
            and {Zabbix server:system.cpu.load[].time()}>170000
            and {Zabbix server:system.cpu.load[].time()}<180000

            Comment

            • luissuez
              Junior Member
              • Sep 2018
              • 11

              #7
              Hello Zux
              thanks for your assistance

              I change my code with yours:

              [CODE]{Zabbix server:db.odbc.select[GesIntel,ESTTEL].last()}>0
              and {Zabbix server:db.odbc.select[GesIntel,ESTTEL].time()}>130000
              and {Zabbix server:db.odbc.select[GesIntel,ESTTEL].time()}<150000[\CODE]

              But I still have the same error.
              My zabbix version is 2.2

              Comment

              • zux
                Member
                • Sep 2018
                • 93

                #8
                First of all - I would upgrade
                Second, start by looking at the documentation for you version, there are changes in newer releases:
                https://www.zabbix.com/documentation...ers/expression
                I don't have 2.2 to test on, but it looks like the function "and" was not implemented, the examples at documentation mention "&"

                Comment

                • luissuez
                  Junior Member
                  • Sep 2018
                  • 11

                  #9
                  Zux
                  you're right
                  After checking the doc I put this:

                  Code:
                  {Zabbix server:db.odbc.select[GesIntel,ESTTEL].last()}>0
                  & {Zabbix server:db.odbc.select[GesIntel,ESTTEL].time()}>130000
                  & {Zabbix server:db.odbc.select[GesIntel,ESTTEL].time()}<150000
                  and now it works fine.
                  Thanks all for the assistance

                  Cheers

                  Comment

                  Working...