Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-4627

Support of regsub() for LLD macros

XMLWordPrintable

    • Icon: Change Request Change Request
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 4.0.0beta1, 4.0 (plan)
    • None
    • Server (S)
    • None
    • Sprint 37, Sprint 38, Sprint 39, Sprint 40, Sprint 41
    • 3

      Zabbix must support regsub() and iregsub() functions for LLD macros. It will allow to extract certain parts of LLD macro using regular expression. The functions will be supported in all locations allowed for LLD macros.

      A typical use case

      A LLD macro contains customer name and network interface number:

      {#IFALIAS}=customername_1

      I want to extract and use customer name and interface number in trigger tags "Customer" and "IF", therefore I take advantage of the function regsub():

      Customer: {{#IFALIAS}.regsub("(.*)_([0-9]+)", \1)}
      IF: {{#IFALIAS}.regsub("(.*)_([0-9]+)", \2)}

        1. Selection_563.png
          55 kB
          Larisa Grigorjeva
        2. zbx_export_hosts(1).xml
          15 kB
          Alexander Vladishev

            viktors.tjarve Viktors Tjarve
            palivoda Rostislav Palivoda
            Team A
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: