[ZBX-16438] Zabbix LLD rule produces non-expanding application prototypes, when particular macro not present in JSON data set Created: 2019 Jul 31 Updated: 2020 Jun 15 Resolved: 2020 Jun 15 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F), Server (S) |
Affects Version/s: | 4.0.10 |
Fix Version/s: | None |
Type: | Problem report | Priority: | Trivial |
Reporter: | Vadims Kurmis | Assignee: | Kristians Pavars |
Resolution: | Won't fix | Votes: | 0 |
Labels: | LLD, application, discovery, macro, prototype | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Description |
Steps to reproduce:
And for item prototype: Host["bbb.contoso.com"] in applications field macros are expanded to:
Non-present macros for application prototypes should not be just placed there, because it's a macro. So the expected behavior is that Zabbix should not generate wrong and incorrect applications for missing macros. I know, this helps troubleshooting, so that it will be visible to zabbix administrator, that some macro did not expand and something might be missing, but this would be better made another way. The requirement is to make discovery with variable application prototype amount. If I specify only one application prototype, for example like "{#GROUP}" and then send discovery JSON in two parts, then application prototype just gets overwritten. Also, there is no "filter" option for Item Prototype, which would help in this case as I could simply create 5 items, where 1st item looks for {#GROUP_1} macro non-empty, 2nd looks for {#GROUP_1} and {#GROUP_2} macros non empty and last 5-th item would check if JSON data set has all 5 group macros present.
Result: |
Comments |
Comment by Vadims Kurmis [ 2019 Jul 31 ] |
I was able to implement above logic by creating 2 discovery rules "host.discovery.1" and "host.discovery.2". Then I send the same JSON to both LLD rules. LLD rule "host.discovery.1" filters by "{#GROUP_1}" match ".+" LLD rule "host.discovery.2" filters by "{#GROUP_1}" match .+ and "{#GROUP_2}" match .+ This workaround works. However, it would be more nice if Zabbix would not generate non-expanding application names, then the same could be achieved by using single LLD rule.
|
Comment by Glebs Ivanovskis [ 2019 Aug 01 ] |
What should Zabbix do if application prototype name is "{#GROUP_1} {#GROUP_2}" and there is only {#GROUP_1} value in the data, but no {#GROUP_2} value? Should Zabbix create a half of application? |
Comment by Vadims Kurmis [ 2019 Aug 01 ] |
For app prototype - "{#GROUP_1} {#GROUP_2}" where macro "{#GROUP_2}" missing - discover as "{#GROUP_1}". I think it would be better than having erroneous app prototypes generated, without even warning, that macro expansion failed - no error message for LLD rule. |
Comment by Glebs Ivanovskis [ 2019 Aug 01 ] |
Hm, maybe we need more granular LLD filters? Potentially for every single item/trigger/application/graph prototype. |
Comment by Vadims Kurmis [ 2019 Aug 01 ] |
That JSON thing is very different for many cases. What about expanding missing macro to empty string? Other macros work like this. And from this it could be made that "app prototype", which name is missing macro, expands to empty string and hence - it won't be discovered in this case |
Comment by Vadims Kurmis [ 2019 Aug 01 ] |
Windows and Linux consoles expand missing macro to empty string |
Comment by Vadims Kurmis [ 2019 Oct 24 ] |
Any progress on this? Is this considered for next Zabbix releases? This is a common behavior for most scripting languages that non-existing macros expand to empty string. I can mention at least: bash, batch, vbscript, powershell - work like this.
|
Comment by Kristians Pavars [ 2020 Jun 12 ] |
Hi Vadims,
Sorry for the long delay on this ticket. This looks more like a feature request and not a bug with Zabbix, have you raised a feature request for it?
Thanks, |