Ad Widget

Collapse

cannot perform regular express match for value of type string: pattern does not match

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cyberphantom
    Member
    • Dec 2021
    • 67

    #1

    cannot perform regular express match for value of type string: pattern does not match

    Hello
    I've configured an prototype item on zabbix and added a regex preprocessing: "{#TEST6}":"(.*?)" cause the output of my main item is a block of text, like:

    [{"{#TEST}":"aaaa","{#TEST2}":"bbbb","{#TEST3}": "cc cc","{#TEST4}":"dddd","{#TEST5}":"eeee","{#TEST6}":"6","{#TEST7}":"ffff","{#TEST8}":"gggg"}(...it continues repeating the same)

    I've tested this regex on regex101, it worked well, but on zabbix my items are not supported and with this error -> "Preprocessing failed for: [{"{#TEST}":" 1. Failed: cannot perform regular expression ""6":"(.*?)"" match for value of type "string": pattern does not match"
    It seems that the preprocessing is working, because it's returning the correct value (in this case, 6)...
    The itens are configured with the type "text".
    It's something wrong with regex?
    Last edited by cyberphantom; 19-01-2022, 16:10.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Works as expected for me...

    Click image for larger version

Name:	test6.png
Views:	5009
Size:	34.2 KB
ID:	438352

    Only way I managed to get similar error was, when I entered "6" into macro value instead of {#TEST6}.

    Click image for larger version

Name:	test66.png
Views:	4984
Size:	37.7 KB
ID:	438353

    Comment

    • cyberphantom
      Member
      • Dec 2021
      • 67

      #3
      Thanks for your answer!!
      I see...
      Here it's working now, my items are enabled and I tested some items, preprocessing is returning the expected value. But I can't see this value in "latest data" in "last value" field
      Click image for larger version  Name:	Capturar4.png Views:	0 Size:	55.2 KB ID:	438366 Is this right? I'm new to Zabbix, so maybe I'm doing something wrong...
      These items were generated by a discovery rule, they are dependent items (in item prototype) of the master item, which is a "database monitor" type item. This master item is collecting data from my DB, and it's working well... as you can imagine, this DB data collector item is using the key "db.odbc.discovery" so it's transforming the response as lld macros ([{"{#TEST}":"aaaa","{#TEST2}":"bbbb","{#TEST3}": "cc cc","{#TEST4}":"dddd","{#TEST5}":"eeee","{#TEST6}":"6","{#TEST7}":"ffff","{#TEST8}":"gggg"](...))
      I'm trying to understand what's happening...

      Comment

      • cyberphantom
        Member
        • Dec 2021
        • 67

        #4
        Ok, I understood why this is happening
        I've unmarked the option "Storage period" and forgot it
        now is returning the values, but regex is catching just the first value, so every item is with the same value, which is wrong
        Trying to solve it
        Last edited by cyberphantom; 20-01-2022, 15:15.

        Comment

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

          #5
          Setting storage period to 0 is only useful for master items, which retrieve a lot of data and spread it down to dependent items. So each time you pull data, it is preprocessed an split up to dependent items and that big master data is never saved to DB. Saves a lot of room.

          Comment

          • shawnbrown
            Junior Member
            • Jan 2022
            • 2

            #6
            Originally posted by cyber
            Works as expected for me...

            Click image for larger version  Name:	test6.png Views:	17 Size:	34.2 KB ID:	438352

            Only way I managed to get similar error was, when I entered "6" into macro value instead of {#TEST6}. JJsploit

            Click image for larger version  Name:	test66.png Views:	16 Size:	37.7 KB ID:	438353
            Thanks a lot This totally worked for me
            Last edited by shawnbrown; 21-01-2022, 13:27.

            Comment

            • shawnbrown
              Junior Member
              • Jan 2022
              • 2

              #7
              Also try to check the option called "Storage period", it might work for you

              Comment

              Working...