Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-21998

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

XMLWordPrintable

      To my knowledge, this issue was first reported at this forum topic.

      With the "find" function, when using a regular expression and trying to escape a dot (.) character, Zabbix displays an incorrect parameter error.

      TEST EXAMPLE:

      Zabbix Proxy version has the string "6.2.4".

      If trying to create a calculated item with the following formula, Zabbix displays an invalid parameter error.

      find(/zbxproxy/zabbix[version],,"regexp","^6\.2")
      Cannot update item
      Invalid parameter "/1/params": incorrect expression starting from "find(/zbxproxy/zabbix[version],,"regexp","^6\.2")".

      The same happens when trying to create or update a trigger.

      Cannot update trigger
      Invalid parameter "/1/expression": incorrect expression starting from "find(/zbxproxy/zabbix[version],,"regexp","^6\.2")=0".​ 
      
      

      Zabbix displays an incorrect expression if using the backslash escape character ({}) with either single or double quotes.

      find(/APP Zabbix Proxy/zabbix[version],,"regexp","^6\.2")
      find(/APP Zabbix Proxy/zabbix[version],,"regexp",'^6\.2')

      A valid expression is accepted if using two backslashes, but the result is false (= 0) as the actual backslash character is escaped.

      find(/APP Zabbix Proxy/zabbix[version],,"regexp","^6\\.2")

      By removing the escape character ({}) the expression is accepted. Still, the the dot character is interpreted as "any character".

      find(/APP Zabbix Proxy/zabbix[version],,"regexp","^6.2")

      It also accepts brackets between the dot.

      find(/APP Zabbix Proxy/zabbix[version],,"regexp",'^6[.]2')

      Despite Zabbix invalid parameter, he simple regular expression ("^6\.2") is compatible with PCRE.

      I've also tried messing with Zabbix DB to force the backslash character in the expression.

      My test item has the following values in Zabbix DB.

      mysql> select params from items where itemid=44280;
      +--------------------------------------------------+
      | params                                           |
      +--------------------------------------------------+
      | find(/zbxproxy/zabbix[version],,"regexp","^6.2") |
      +--------------------------------------------------+

       

      Updating the item "params" yelds an unsupported item.

      mysql> update items set params='find(/zbxproxy/zabbix[version],,"regexp","^6\\.2")' where itemid=44280;
      Query OK, 1 row affected (0.01 sec)
      Rows matched: 1  Changed: 1  Warnings: 0 
      
      
      mysql> select params from items where itemid=44280;
      +---------------------------------------------------+
      | params                                            |
      +---------------------------------------------------+
      | find(/zbxproxy/zabbix[version],,"regexp","^6\.2") |
      +---------------------------------------------------+

      Unfortunately, the Frontend displays the following error.

      Cannot parse formula: invalid escape sequence in string starting with "\.2")"

       

      I'm not sure this issue happens with other functions aswell.

      It would be nice to escape the dot character. Sometimes it can come in handy.

            ksalins Karlis Salins
            markfree MArk
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: