[ZBXNEXT-4087] Allow preprocessing in LLD rules Created: 2017 Sep 06  Updated: 2024 Apr 10  Resolved: 2019 Apr 12

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: 4.0.0alpha1
Fix Version/s: 4.2.0beta1, 4.2 (plan)

Type: New Feature Request Priority: Major
Reporter: Glebs Ivanovskis (Inactive) Assignee: Andris Zeila
Resolution: Fixed Votes: 25
Labels: lld, preprocessing
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: PDF File ACC - Support preprocessing for LLD rules - v1.1 .pdf     PDF File Preprocessing for LLD 1.0rc1.pdf     PDF File Preprocessing for LLD 1.0rc3.pdf     XML File zbx_export_hosts_2_log.xml    
Issue Links:
Duplicate
duplicates ZBXNEXT-4037 Item pre-processing for LLD rules Closed
is duplicated by ZBXNEXT-4004 offload LLD data processing from trap... Closed
is duplicated by ZBXNEXT-4031 Accept simple JSON array as LLD data Closed
Sub-task
depends on ZBXNEXT-4877 Add support for custom JSON path in L... Closed
depends on ZBXNEXT-4004 offload LLD data processing from trap... Closed
part of ZBXNEXT-4086 Extend item preprocessing with functi... Closed
part of ZBXNEXT-4683 Change ODBC LLD discovery to use {#<j... Closed
part of ZBXNEXT-4865 Prometheus format native support Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
ZBXNEXT-4854 Frontend changes in allow preprocessi... Change Request (Sub-task) Closed Ivo Kurzemnieks  
Team: Team A
Sprint: Sprint 46, Nov 2018, Sprint 47, Dec 2018, Sprint 48, Jan 2019, Sprint 49 (Feb 2019), Sprint 50 (Mar 2019), Sprint 51 (Apr 2019)
Story Points: 5

 Description   

Maybe it's a duplicate, but I failed to find original issue.

The request is quite obvious and "in the air" after ZBXNEXT-1443 was implemented.



 Comments   
Comment by Marc [ 2018 Aug 15 ]

Maybe it's a duplicate, but I failed to find original issue.
ZBXNEXT-4037 sounds to be a candidate 

Comment by Alexei Vladishev [ 2018 Aug 20 ]

Hey all! Please have a look at the attached acceptance criteria document that covers proposed functionality. It has all chances to be implemented in Zabbix 4.2. Let me know what you think. Is there anything to improve? I appreciate any feedback.

Comment by Jan Garaj [ 2018 Aug 20 ]

Hey Alex,

I would like to use this functionality for containers discovery. Related questions:

  • How will edge cases (for example JSON key not found, a key has the null value, ...) be processed? Will it break LLD process or only LLD item or some <unknown> value will be used?
  • Will it be possible to use it also for creating of item/host tags (from container labels in my case)?
Comment by Alexei Vladishev [ 2018 Aug 21 ]

How will edge cases (for example JSON key not found, a key has the null value, ...) be processed? Will it break LLD process or only LLD item or some <unknown> value will be used?

Same logic as we have now for LLD macros. If a key not found the macro will stay as it it, i.e. will not be substituted.

Will it be possible to use it also for creating of item/host tags (from container labels in my case)?

Not yet. It may come in the future.

Comment by Glebs Ivanovskis [ 2018 Sep 06 ]

So the plan is to convert every imaginable source of data for low-level discovery into JSON with a specific preprocessing step? It is relatively for CSV, but I'm not sure it is the best approach in the long-term.

First of all, JSON capabilities are limited. Imagine I have XML I want to use for discovery:

<data>
  <element key="attribute1">
    <key>entity1</key>
  </element>
  <element key="attribute2">
    <key>entity2</key>
  </element>
</data>

Note that the "key" stands for both an attribute name and a nested tag. How can such XML be converted into JSON?

Secondly, since every input format needs a very specific preprocessing step to convert it into JSON, it will take a very long time to implement even most frequently used scenarios (CSV in 4.2, XML in 4.4, YAML in 5.0, etc.) In the meantime many users will have to resort to scripting or will simply choose a different monitoring solution.

In my understanding, preprocessing pipeline for LLD rules should be just like preprocessing of regular items right to the point where we have an array of some sort (JSON array, XML array, array of /.../g regexp matches, you name it). Then there should be a breaking point stating the type of array we've got. And from there Zabbix should start a bunch of independent preprocessing pipelines to extract values of every LLD macro user needs (I would use XPath here in case of my XML example: string(element/@key) ⇒ {#ATTRIBUTE}, string(element/key) ⇒ {#ENTITY}), each ending with a name for the end result (conventional {#MACRO}). Implementation costs should be fairly low because Zabbix already knows how to iterate JSON and XML arrays, adding iteration of regexp matches or CSV rows shouldn't be difficult. And the end solution will be very flexible and extendable, because user will be able to use all the available preprocessing steps, both to prepare data and extract macro values.

Comment by Dimitri Bellini [ 2018 Sep 12 ]

Hi Devs,
I think it could be more useful and could provide more flexibility the implementation of this feature "Internal job scheduler for Zabbix" (ZBXNEXT-3931) compared to this one.
This is my point of view

Comment by Alexei Vladishev [ 2018 Sep 21 ]

Gleb, it is a nice idea at the expense of extra configuration complexity, i.e. we should specify correct data type. Native support of XML is nice to have, I am not sure it is required from day one.

Dimitry, please stay on topic.

I just attached version 1.0rc3 of the spec, sorry for formatting issues.

Comment by Glebs Ivanovskis [ 2018 Sep 23 ]

I really like the idea of auto-completion!

Comment by Vitaly Zhuravlev [ 2018 Nov 26 ]

The new version (v.1.1) of acceptance criteria is attached

Comment by Glebs Ivanovskis [ 2018 Nov 26 ]

Comment by Ivo Kurzemnieks [ 2019 Jan 31 ]

Implemented in pre-4.2.0alpha4 (trunk) r89234

Comment by Ivo Kurzemnieks [ 2019 Feb 01 ]

Updated API documentation:

Comment by richlv [ 2019 Apr 09 ]

Thank you for the API documentation links, Ivo. Other relevant documentation pages:

Comment by Alexander Vladishev [ 2019 Apr 12 ]

Updated documentation:

Generated at Thu Apr 25 19:29:52 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.