Ad Widget

Collapse

Tiger on exact time and date

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alfista
    Senior Member
    • Mar 2017
    • 136

    #1

    Tiger on exact time and date

    Hi,

    I need to run trigger on exact time.
    I use this expression:
    Code:
    dayofweek()=1 $ time()=080000
    but I can't use it while I have this error:
    Code:
    Cannot add trigger
    Invalid parameter "/1/expression": incorrect expression starting from "$ time()=080000". [triggers.php:300 → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CTrigger->create() → CTriggerGeneral->validateCreate() → CApiService::exception() in include/classes/api/services/CTriggerGeneral.php:1009]​
    Please can you help me and tell me where is the problem?
    Thanks
  • Answer selected by Alfista at 14-11-2023, 09:59.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    Of course trigger will not work without any reference to any key... What would you be calculating otherwise?

    & will not work also AND (as I suggested, I wanted to emphasize the word itself, not the case, bad attempt.. ), just lowercase and.

    Comment

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

      #2
      (incorrect expression starting from "$....)
      $ does not work there... use AND

      Comment

      • Alfista
        Senior Member
        • Mar 2017
        • 136

        #3
        Sorry my mistake.
        I use the Zabbix version 6.4.4
        There should be "&", but it will not work even there is an any function alone. I tried also to do it with expression constructor and still ai get error:
        Code:
        Invalid parameter "/1/expression": trigger expression must contain at least one /host/key reference. [triggers.php:300 → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CTrigger->create() → CTriggerGeneral->validateCreate() → CApiService::exception() in include/classes/api/services/CTriggerGeneral.php:1009]
        Last edited by Alfista; 13-11-2023, 16:07.

        Comment

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

          #4
          Of course trigger will not work without any reference to any key... What would you be calculating otherwise?

          & will not work also AND (as I suggested, I wanted to emphasize the word itself, not the case, bad attempt.. ), just lowercase and.

          Comment

          • Alfista
            Senior Member
            • Mar 2017
            • 136

            #5
            I use this now:
            Code:
            dayofweek()=1 AND time()=080000
            and have this error:
            Code:
            Invalid parameter "/1/expression": incorrect expression starting from "AND time()=080000". [triggers.php:300 → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CTrigger->create() → CTriggerGeneral->validateCreate() → CApiService::exception() in include/classes/api/services/CTriggerGeneral.php:1009]
            What I do wrong? Why it will not work?

            Comment

            • Semiadmin
              Senior Member
              • Oct 2014
              • 1625

              #6
              As cyber​ already said, there must be at least one item in the trigger. And then, if you are very lucky, your trigger will fire (with a probability of 1/30)

              Comment

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

                #7
                And as I said...
                Originally posted by cyber
                & will not work also AND (as I suggested, I wanted to emphasize the word itself, not the case, bad attempt.. ), just lowercase and.

                Comment

                • Alfista
                  Senior Member
                  • Mar 2017
                  • 136

                  #8
                  Thanks understand - i need leave there any item that is taken from the Host and then I can add there my triger items.
                  This isnt written in the manual that thistrigger functions cant be used allone in the trigger. I thing this is a byg mistake while some trigers need to be releated to some procedures that should be done on exact time and this will help to remember if you forgote to do it.
                  I have now change the trigger to​:
                  Code:
                  last(/192.168.22.50/system.uptime)<7d and dayofweek()=2 and time()=080000
                  Thanks.

                  Comment

                  • Semiadmin
                    Senior Member
                    • Oct 2014
                    • 1625

                    #9
                    ....and between(time(),080000,080100)

                    Comment

                    • Alfista
                      Senior Member
                      • Mar 2017
                      • 136

                      #10
                      Great sugestion. Thanks.

                      Comment

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

                        #11
                        Originally posted by Alfista
                        This isnt written in the manual that thistrigger functions cant be used allone in the trigger. .


                        Attention: Date and time functions cannot be used in the expression alone; at least one non-time-based function referencing the host item must be present in the expression.

                        But what would you trigger without any item values? Just a notification popup/reminder? That is really something that triggers are not meant to do..
                        You can probably utilize calculated items, which will calculate some dummy value every minute (as simple as just return value 1 every minute) and then use it together with those day/time functions to trigger some alert(s).​ But you have to have an item in calculation..

                        Comment

                        Working...