Ad Widget

Collapse

Trigger expression problem

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pstage
    Junior Member
    • Apr 2022
    • 7

    #1

    Trigger expression problem

    Hi Everyone,

    I'm on Zabbix 6.0 and and need to know what is wrong in the following trigger expression :

    {CheckMultiIP.SNMP:logrt[/tmp/MultiIp.log,.*,,,all].regexp(TEST)} = 1
    My tpl's name is "CheckMultiIP.SNMP" ; My item key is "logrt[/tmp/MultiIp.log,.*,,,all]" ... but it keep telling me there's an invalid parameter

    However, it seems this notation is an old one, but if this is the case, how can you write that expression in the Zabbix 6 way ? it seems regexp is not available ...

    Thx for your replies.
    Attached Files
    Last edited by pstage; 12-02-2025, 17:41.
  • Answer selected by pstage at 13-02-2025, 15:30.
    kyus
    Senior Member
    • Feb 2024
    • 172

    I'm not sure if I understood what you need...
    Can you show the configuration of the item + trigger?

    There's also macro functions. Not sure if it helps you in any way...

    Comment

    • kyus
      Senior Member
      • Feb 2024
      • 172

      #2
      find(/CheckMultiIP.SNMP/logrt[/tmp/MultiIp.log,.*,,,all],,"like","regexp")

      Comment

      • pstage
        Junior Member
        • Apr 2022
        • 7

        #3
        Hi and thx for your answer. However, I did of course tried to use the 'find' function, but that's not really my need.

        Let me explain:
        - I have an item that gets a textual info
        - I have a preprocessing for that item using a regular expression that "cuts" the item's response and fills up 4 variables \1, \2, \3 and \4
        - In the corresponding trigger, I want to be able to use those variables INDEPENDENTLY (to create my own event name or to fill up some tags or whatever)

        -> If I use the 'find' function, I get the whole item's response : this is not what I need
        -> How, in my trigger, can I refer to those 4 variables. I've tried, unsuccessfully for now, with the 'regexp' function

        Comment

        • kyus
          Senior Member
          • Feb 2024
          • 172

          #4
          I'm not sure if I understood what you need...
          Can you show the configuration of the item + trigger?

          There's also macro functions. Not sure if it helps you in any way...

          Comment

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

            #5
            Preprocessing is for manipulating incoming data, item value.. If you split it in preprocessing and output "\1 \2 \3 \4"ยด, then this output becomes your saved value of item ... it does not save each part seprately somehow...


            If you want to use part of item value in "trigger name" then use "Event name" field and use "{{ITEM.VALUE}.regsub("<your regex>",\1 \2)}" there (don't forget to escape needed things like \-s, "-s etc in regex).


            In trigger expression you are also referring to this preprocessed value, there is no "variables" any more to refer to. You have to find match to your regex... with the help of find() function. Result either matches (=1) or does not (=0).
            For tags use the same method as in "Event name", to extract a value from item value.
            Last edited by cyber; 13-02-2025, 15:31.

            Comment

            • pstage
              Junior Member
              • Apr 2022
              • 7

              #6
              Thx a lot for your help guys : I indeed managed to do it that way. Have a nice day

              Comment

              Working...