-
Problem report
-
Resolution: Won't fix
-
Trivial
-
None
-
4.0.16
-
None
Steps to reproduce:
- We are trying to use regsub in item prototype of a discovery to remove the last number after last full stop.
- use the following key x["{
{#SYSTEMNAME}.regsub(\"(.*)\.(\d+)\", \1)}.{#DEVICEID}"] in a trapper item
Result:
{#SYSTEMNAME}being VSP F700.415594.5 and
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]