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

unable to create item prototype key without quote while using regsub

    XMLWordPrintable

    Details

    • Type: Problem report
    • Status: Closed
    • Priority: Trivial
    • Resolution: Won't fix
    • Affects Version/s: 4.0.16
    • Fix Version/s: None
    • Component/s: Server (S)
    • Labels:
      None

      Description

       

      Steps to reproduce:

      1. We are trying to use regsub in item prototype of a discovery to remove the last number after last full stop.
      2. use the following key x["{ {#SYSTEMNAME}.regsub(\"(.*)\.(\d+)\", \1)}.{#DEVICEID}"] in a trapper item

        Result:
        {#SYSTEMNAME}

        being VSP F700.415594.5 and

      {#DEVICEID}

      being 50060E80123CEA20

      discovered item example is:
      x["VSP F700.415594.50060E80123CEA20"]

      Expected:

      x[VSP F700.415594.50060E80123CEA20]

      How to get rid of double quotes in the key?

      Tried many other unsuccessful formulas :

       

      trial #2: (We don't put outer quotes, escaped inner quotes)

      x[{

      {#SYSTEMNAME}.regsub(\"(.*)\.(\d+)\", \1)}.{#DEVICEID}]

      result #2:

      x[\{VSP F700.415594.2.regsub(\"(.*)\.(\d+)\", \1)}.50060E80123CEA62]

       

      trial #3: (We don't put outer quotes, put inner quotes)

      x[{{#SYSTEMNAME}

      .regsub("(.*)\.(\d+)", \1)}.{#DEVICEID}]

      result #3:

      x[\{VSP F700.415594.1.regsub("(.*)\.(\d+)", \1)}.50060E80123CEA61]

       

      Trial #3 is inspired by example in the manual but it doesn't work.

      https://www.zabbix.com/documentation/4.0/manual/config/macros/macro_functions?s[]=regsub

       

      customername_1 {{ {\{#IFALIAS}

      .regsub("(.*)_([0-9]+)", \1)}}}

      customername

       

      trial #4: (We escaped outer quotes, put  inner quotes)

       x[\"{

      {#SYSTEMNAME}.regsub("(.*)\.(\d+)", \1)}.{#DEVICEID}\"]

      result #4:

      [\"\{VSP F700.415594.19.regsub("(.*)\.(\d+)", \1)}.50060E80123CEA13\"]

        

      trial #5: (We escaped outer quotes, escaped  inner quotes)

       x[\"{{#SYSTEMNAME}

      .regsub(\"(.*)\.(\d+)\", \1)}.{#DEVICEID}\"]

      result #5:

      [\"\{VSP F700.415594.19.regsub(\"(.*)\.(\d+)\", \1)}.50060E80123CEA13\"]

       

      Whatever we tried we couldn't get x[VSP F700.415594.50060E80123CEA20]

       

       

        Attachments

          Activity

            People

            Assignee:
            zabbix.support Zabbix Support Team
            Reporter:
            leventkarakas Levent Karakaş
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: