-
Problem report
-
Resolution: Commercial support required
-
Trivial
-
None
-
5.4.10
Hi there,
I want to create a discovery rule and items based on a JSON file. The file looks like this:
[ { "service":"app1", "status":"running" }, { "service":"app2", "status":"running" }, { "service":"app3", "status":"running" } ]
Based on that I and to create an item for each service which returns the status.
I made those steps:
- Created item in template to get the JSON data
- Created discovery rule
- Type: "Dependent item" from the item in 1.
- No preprocessing
- LLD macros:
- {{
{#SERVICENAME}
> $[*].["service"]}}
- {{
{#STATUS}
}}> ${{[*].["status"]}}
- {{
{#SERVICENAME}
- No Filters
- Created Item prototype
- Name: [Discovery] Status {#SERVICENAME}
- Type : "Dependent item" from the item in 1.
- Key: something{#SERVICENAME}
- Preprocessing: JSONPath:
- $..[?(@.service == '\{#SERVICE}')].status
Now after this is done, I would expect to get something like
- [Discovery] Status app1
- Key: something[app1]
- Result: ["running"]
- [Discovery] Status app2
- Key: something[app2]
- Result: ["running"]
- [Discovery] Status app3
- Key: something[app3]
- Result: ["running"]
But it doesn't work because the item prototype isn't expanding the macros. This is what I get as error in the Discovery rules tab in the host:
So why is it not expanding my macros?
I was already searching for that problem and I already find related problems with "Zabbix trapper" items - but it does not apply here