Ad Widget

Collapse

Zabbix 6 regexp: incorrect expression "6\.0"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tuxmartin
    Junior Member
    • Jan 2017
    • 12

    #1

    Zabbix 6 regexp: incorrect expression "6\.0"

    Hi,
    I have been using regular expression "6\.0" for many years without problem.
    But now it is invalid:
    Code:
    Cannot update trigger
    Invalid parameter "/1/expression": incorrect expression starting from "find(/APP Zabbix Proxy/zabbix[version],1m,"regexp","6\.0")=0".​

    I'm using Zabbix 6.0.10. I'm not sure if it is broken since upgrade to Zabbix 6.0 or after update to some patch version 6.0.x.

    I need to check if zabbix proxy version is exactly "6.0".​
    I found info about PCRE2 https://www.zabbix.com/documentation...ching-to-pcre2 but if I try my regex on the page https://regex101.com/r/toKR96/1 it's compatible with PCRE and PCRE2 too:
    Click image for larger version  Name:	Výběr_2023.png Views:	0 Size:	21.0 KB ID:	455003

    How can I fix it?

    Thanks.
  • markfree
    Senior Member
    • Apr 2019
    • 868

    #2
    The issue there has to do with the backslash character within your expression, (\).
    You can remove it, then, your function will become valid and your dot character will be interpred as any character.

    I would also suggest removing the first parameter "1m" as it seems your trigger is evaluating the latest value from your item.
    The "find" function already defaults to the latest value if not specified.

    Code:
    find(/APP Zabbix Proxy/zabbix[version],,"regexp","6.0")=0
    Last edited by markfree; 28-11-2022, 01:00.

    Comment

    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #3
      Does it make a difference if you use single quotes around the regex?

      If that doesn't make a difference, does it make a difference if you double up the backslashes?

      I agree that your regex is valid and I agree there's a reason to want the backslash there. My guess is that there's some interplay with backslash parsing in strings in Zabbix.​

      Comment

      • tuxmartin
        Junior Member
        • Jan 2017
        • 12

        #4

        incorrect expression (single/double quotes):
        Code:
        find(/APP Zabbix Proxy/zabbix[version],,"regexp","^6\.0")=0
        find(/APP Zabbix Proxy/zabbix[version],,"regexp",'^6\.0')=0
        valid expression, but not working:
        Code:
        find(/APP Zabbix Proxy/zabbix[version],,"regexp","^6\\.0")=0
        this works great:
        Code:
        find(/APP Zabbix Proxy/zabbix[version],,"regexp","^6.0")=0
        But ​I would like to know how to escape dot. Sometimes it can come in handy.

        Comment

        • Markku
          Senior Member
          Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
          • Sep 2018
          • 1782

          #5
          I'd say it is a bug. Please open an issue in https://support.zabbix.com

          (If there isn't one already)

          Markku

          Comment

          • Markku
            Senior Member
            Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
            • Sep 2018
            • 1782

            #6
            I need to check if zabbix proxy version is exactly "6.0".​​
            Would this do: "^6[.]0"

            Markku

            Comment

            • markfree
              Senior Member
              • Apr 2019
              • 868

              #7
              Originally posted by Markku
              Would this do: "^6[.]0"
              Markku
              It accepts brackets between the dot and the result is positive.
              Code:
              find(/APP Zabbix Proxy/zabbix[version],,"regexp",'^6[.]0')
              Still, as tuxmartin mentioned, it would be nice to escape the dot character.

              Therefore, I've created the issue ZBX-21998.

              Comment

              • Hamardaban
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • May 2019
                • 2713

                #8
                It seems to have been fixed in version 6.0.11

                Comment

                • markfree
                  Senior Member
                  • Apr 2019
                  • 868

                  #9
                  My tests used Zabbix 6.2 and, after upgrading to 6.2.5, the issue is still present.
                  Click image for larger version

Name:	image.png
Views:	1452
Size:	12.0 KB
ID:	455313
                  Can you confirm that it was fixed in 6.0.11​?

                  Comment

                • markfree
                  Senior Member
                  • Apr 2019
                  • 868

                  #10
                  Both release notes mention 2 fixes with incorrect backslash escaping. As I understand it, they are not the same issue.
                  As I said, in my testing with version 6.2.5, the issue is still present.

                  When you said it seemed fixed for version 6.0.11, I thought you had tested it out.

                  Comment

                  • zabbixuserfk
                    Member
                    • Apr 2020
                    • 37

                    #11
                    Hello,
                    I think I have a similar issue on Zabbix 6.4.2. Is it supposed to be fixed please ?​

                    Comment

                    • markfree
                      Senior Member
                      • Apr 2019
                      • 868

                      #12
                      Originally posted by zabbixuserfk
                      I think I have a similar issue on Zabbix 6.4.2. Is it supposed to be fixed please ?​
                      I believe this was fixed in issue ZBX-21898.
                      Available in versions:
                      Updated documentation:
                      In my tests with Zabbix 6.4.11, it now works as expected.
                      Last edited by markfree; 11-02-2024, 16:57.

                      Comment

                      • omar.cacciotti
                        Junior Member
                        • Jul 2021
                        • 25

                        #13
                        Originally posted by markfree

                        I believe this was fixed in issue ZBX-21898.




                        In my tests with Zabbix 6.4.11, it now works as expected.
                        It seems that it doesn't work again in Zabbix 7.0

                        This regex is valid but not working
                        Code:
                        [B]^[A-Z]{3}AT[A-Z][0-9]\.D20[0-9]{5}\.T[0-9]{6}[/B]
                        I'm trying to double backslash the dot

                        Comment

                        • markfree
                          Senior Member
                          • Apr 2019
                          • 868

                          #14
                          Originally posted by omar.cacciotti
                          It seems that it doesn't work again in Zabbix 7.0
                          This regex is valid but not working
                          Code:
                          [B]^[A-Z]{3}AT[A-Z][0-9]\.D20[0-9]{5}\.T[0-9]{6}[/B]
                          I'm trying to double backslash the dot
                          You could try to test this expression with a testing tool like RegexR.
                          There are also some examples in the documentation that might help.

                          Comment

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

                            #15
                            Originally posted by omar.cacciotti

                            It seems that it doesn't work again in Zabbix 7.0

                            This regex is valid but not working
                            Code:
                            [B]^[A-Z]{3}AT[A-Z][0-9]\.D20[0-9]{5}\.T[0-9]{6}[/B]
                            I'm trying to double backslash the dot
                            Click image for larger version

Name:	image.png
Views:	364
Size:	23.5 KB
ID:	494430
                            Not valid as it seems... but has nothing to do with escaping dots...

                            Comment


                            • omar.cacciotti
                              omar.cacciotti commented
                              Editing a comment
                              Sorry I didn't see and .. it is a refuse. I suppose a copy/past error.
                              The regex is ^[A-Z]{3}AT[A-Z][0-9]\.D20[0-9]{5}\.T[0-9]{6}

                              But i had to double backslash the dot to get it working correctly. With a single \ it raise an error

                            • omar.cacciotti
                              omar.cacciotti commented
                              Editing a comment
                              Sorry I didn't see
                              Code:
                               [B] and [/B]
                              during my answer .. it is a refuse. I suppose a copy/past error.
                              The regex is ^[A-Z]{3}AT[A-Z][0-9]\.D20[0-9]{5}\.T[0-9]{6}

                              But i had to double backslash the dot to get it working correctly. With a single \ it raise an error
                          Working...