Ad Widget

Collapse

Str() trigger expression not working as expected

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StealthJoe
    Member
    • Mar 2019
    • 44

    #1

    Str() trigger expression not working as expected

    Lets say I have an item that will return either true or false and the history is something like this:

    Code:
    true
    true
    true
    true
    false
    true
    true
    And I have a trigger expression like the below:

    Code:
    {Zabbix Agent:CheckStatus.str(true)}=0
    I will get a problem created when the "false" value is returned but when the next item comes in as "true" the problem does not resolve. In fact, it never resolves even after repeated "true" values. I fixed one of them by adding a recovery expression but if the text can return more than one value this may not work.

    Is this to be expected? From what the Zabbix Wiki says str() should only evaluate the last value. Should I just switch to using count() instead?

    My Zabbix Server is 4.2.8.
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    Yes, since you are using only one parameter to str() it will always evaluate the latest value. Your expression looks correct and the problem should resolve after receiving "true" value. Could you show the configuration of your trigger, especially these options:

    Click image for larger version

Name:	Configuration-of-triggers.png
Views:	1713
Size:	13.9 KB
ID:	407204

    Comment

    • StealthJoe
      Member
      • Mar 2019
      • 44

      #3
      Originally posted by dimir
      Yes, since you are using only one parameter to str() it will always evaluate the latest value. Your expression looks correct and the problem should resolve after receiving "true" value. Could you show the configuration of your trigger, especially these options:

      Click image for larger version

Name:	Configuration-of-triggers.png
Views:	1713
Size:	13.9 KB
ID:	407204
      Here is the trigger in question. I did remove some personal information as this is a custom user parameter item but otherwise the configuration is the same.

      Attached Files

      Comment

      • dimir
        Zabbix developer
        • Apr 2011
        • 1080

        #4
        Looks good. How often is your configuration reloaded by the server (option CacheUpdateFrequency in zabbix_server.conf)?

        Comment

        • StealthJoe
          Member
          • Mar 2019
          • 44

          #5
          Originally posted by dimir
          Looks good. How often is your configuration reloaded by the server (option CacheUpdateFrequency in zabbix_server.conf)?
          It is set to the default which looks to be 60s?

          Comment

          • dimir
            Zabbix developer
            • Apr 2011
            • 1080

            #6
            Could you show the values coming to this item after the trigger changed to PROBLEM?

            Comment

            • StealthJoe
              Member
              • Mar 2019
              • 44

              #7
              Originally posted by dimir
              Could you show the values coming to this item after the trigger changed to PROBLEM?
              Here is an example from a UserParameter item. The trigger in this case would be:

              Code:
              {Zabbix Agent:CheckStatus.str(Good)}=0
              I should note that this (and most of my text items) are set to "Discard unchanged with heartbeat" using pre-processing.

              Code:
               [TABLE]
              [TR]
              [/TR]
              [TR]
              [TD]2020-08-17 19:02:17[/TD]
               			[TD]Good[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-17 12:36:32[/TD]
               			[TD]Good[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-14 22:26:55[/TD]
               			[TD]Good[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-14 22:24:52[/TD]
               			[TD]Bad[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-14 22:16:36[/TD]
               			[TD]Good[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-14 22:15:34[/TD]
               			[TD]Bad[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-14 19:05:34[/TD]
               			[TD]Good[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-14 19:04:33[/TD]
               			[TD]Bad[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-14 18:13:32[/TD]
               			[TD]Good[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-13 14:31:10[/TD]
               			[TD]Good[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-12 12:02:52[/TD]
               			[TD]Good[/TD]
               		[/TR]
              [TR]
              [TD]2020-08-12 12:00:48[/TD]
               			[TD]Bad[/TD]
               		[/TR]
              [/TABLE]




              Comment

              • dimir
                Zabbix developer
                • Apr 2011
                • 1080

                #8
                I should note that this (and most of my text items) are set to "Discard unchanged with heartbeat" using pre-processing.
                Oh, that makes sense. So you will need to wait till heartbeat is reached or send "Bad" and then "Good" again. The "unchanged" values are discarded without reaching to trigger processing.
                Last edited by dimir; 18-08-2020, 17:36.

                Comment

                • StealthJoe
                  Member
                  • Mar 2019
                  • 44

                  #9
                  Originally posted by dimir

                  Oh, that makes sense. So you will need to wait till heartbeat is reached or send "Bad" and then "Good" again. The "unchanged" values are discarded without reaching to trigger processing.

                  If you see in the example the heartbeat is reached which is why there are multiple "Good" values in a row. Shouldn't these values be processed?

                  Comment

                  • dimir
                    Zabbix developer
                    • Apr 2011
                    • 1080

                    #10
                    Of course they should. And the trigger should resolve to OK.

                    Comment

                    Working...