Ad Widget

Collapse

how to do "contain" in trigger expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • choun
    Junior Member
    • Nov 2019
    • 8

    #1

    how to do "contain" in trigger expression

    Hi, I have the below trigger expression which works great. However, if i want to add one more condition which is when {#POVALUE} contains the word "chrome" (#POVALUE could be chrome, chrome.1, chrome.2...etc,) how can I do that?
    min(/TemplateA/op.depend.item[{#POVALUE},ws],60s)> 15
    min(/TemplateA/op.depend.item[{#POVALUE},ws],60s)> 15 and {#POVALUE} = "chrome" ( this works but it has to match the exact word "chrome" )
    i tried
    1. {#POVALUE} like "chrome"
    2. {#POVALUE} ~ '.*chrome.*'
    ..........etc
    all gave me the error similar to the below
    Invalid parameter "/1/expression": incorrect expression starting from "~ '.*chrome.*'


    Please help!
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #2
    Look at example 6 of this page: https://www.zabbix.com/documentation...ers/expression

    Comment

    • choun
      Junior Member
      • Nov 2019
      • 8

      #3
      Hi Brambo,

      Thanks for your reply. i've tried your post but it didnt work. In the Find() example listed on the site, find(/example.example.com/agent.version,,"like","beta8")=1, you need to put item in the first part(in this case, it's /example.example.com/agent.version). However, in my case, I want to put a value (POVALUE) which returned by my external script instead of the item. So my express should look something like "min(/TemplateA/op.depend.item[{#POVALUE},ws],60s)> 15 and find({#OPVALUE},,"like","chrome")=1

      instead of "like, I tested "{#IVALUE} = "chrome" , and it worked. If i'm sure {#IVALUE} returned the string I expected. However, thats not exactly what I want. instead of " absoluate match ", I would like to use partial match such as " contain" or "like" in my case.

      Zabbix gave the error " Invalid parameter "/1/expression": incorrect expression starting from "find({#OPVALUE},,"like","chrome")=1".


      Please help
      Last edited by choun; 10-01-2025, 09:46.

      Comment

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

        #4
        What would be the point of that trigger?

        Comment


        • choun
          choun commented
          Editing a comment
          the trigger will only get alerted when the below 2 conditions are met
          1. min(/TemplateA/op.depend.item[{#POVALUE},ws],60s) > 15 ( it will verify if the process's working set value in perfmon is > 15, ws is short for working set)
          2. find({#OPVALUE},,"like","chrome")=1 (it will verify if the string of {#OPVALUE} contains the word "chrome" , while {#OPVALUE} could be any Windows process name, such as explore , chrome, firefox...etc)
          Last edited by choun; 10-01-2025, 11:00.
      • choun
        Junior Member
        • Nov 2019
        • 8

        #5
        the trigger will only get alerted when the below 2 conditions are met
        1. min(/TemplateA/op.depend.item[{#POVALUE},ws],60s) > 15 ( it will verify if the process's working set value is > 15, ws is short for working set)
        2. find({#OPVALUE},,"like","chrome")=1 (it will verify if the string of {#OPVALUE} contains the word "chrome" , while {#OPVALUE} could be any Windows process name, such as explore , chrome, firefox...etc)
        Last edited by choun; 10-01-2025, 11:01.

        Comment

        • choun
          Junior Member
          • Nov 2019
          • 8

          #6
          any help is much appreciated.

          Comment

          • Brambo
            Senior Member
            • Jul 2023
            • 245

            #7
            I think you should either look into how to build a trigger and or use the select option in the create trigger section.
            The code you supply in example 2 cant work at all.
            And as code example 2 cant work it would suprise me you make an error in example 1 as well.
            Start using the add button next to the expression field and create your expression from there: Click image for larger version

Name:	image.png
Views:	281
Size:	12.1 KB
ID:	497095

            Comment

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

              #8
              So you are ready to create a whole lot of triggers based on LLD, but only one of them will ever work? You better use LLD overrides to create only, what you need and do not create useless stuff. Or just discover those what you need, not "everything"...

              Comment

              Working...