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

"search" method does not work correctly in javascript preprocessing

    XMLWordPrintable

Details

    • Problem report
    • Status: Closed
    • Trivial
    • Resolution: Won't fix
    • 5.0.20, 5.4.10
    • None
    • Server (S)
    • Debian 10.1 (kernel 4.19.0-18-amd64), zabbix-server 5.0.20, nginx 1.20

    Description

      Steps to reproduce:

      1. In the item settings in the preprocessing tab, add the "javascript" step
      2. In the preprocessing parameters, add the context:
      return value.search(/Ok/)>0 ? 1 : 0

      This is a ternary operator that should return "1" if there is a search match in string

      1. Select the "test" action, in the "value" field enter the text:
      Ok
      1. Press "test" button and you will get result 0.
        If the context of the item value exactly matches the search string, then the result is always 0. But if part of the context matches, then the test returns 1.

      Result:
      See screenshot...
      Expected:
      It is expected that if the context of the item value exactly or does not completely match the search string, then the result is always 1.

      Attachments

        1. zabbix_report1.PNG
          zabbix_report1.PNG
          7 kB
        2. zabbix_report2.PNG
          zabbix_report2.PNG
          25 kB
        3. zabbix_report3.PNG
          zabbix_report3.PNG
          25 kB

        Activity

          People

            zabbix.dev Zabbix Development Team
            Catwoolfii Catwoolfii
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: