[ZBXNEXT-4863] Zabbix Configuration as a Code (ZCaasC) Created: 2018 Nov 19  Updated: 2023 Oct 12

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F)
Affects Version/s: 4.2 (plan)
Fix Version/s: None

Type: Change Request Priority: Trivial
Reporter: Aecio Pires Assignee: Valdis Murzins
Resolution: Unresolved Votes: 31
Labels: api, frontend, usability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Frontend and API Zabbix


Issue Links:
Causes
Duplicate
duplicates ZBXNEXT-2754 Export/import templates etc to yaml o... Closed

 Description   

Description: Develop a plugin or functionality to be made available in a submenu (under the Administration menu) where you can export and import the entire Zabbix configuration into YAML files [1] (YAML Is not Markup Language) or XML (Extensible Markup Language) [2].

Motivation: Zabbix currently enables you to export and import XML files for some functionality (Maps, Screens, Templates, Hosts) and also allows interaction with the API to export/import all configuration. But this does not solve a problem: automating the configuration of a Zabbix server pool and manage configuration as a code. For each Zabbix server, there is a set of manual activities: such as user registration, SLA, customer business suitability, among others. This does not make it possible to scale productivity to an X number of servers, and the time to configure them is directly related to the number of people involved in the configuration, number of servers, expertise of the people involved, and configuration complexity to suit the business. Even if a Zabbix is configured for multiple clients, but there are settings that are common or can be reused for multiple clients.
 
Advantages: With the implementation of this functionality, we can have the following advantages:
 
• Increased productivity because you configure a Zabbix server and replicate/export/import/adapt the configuration to N servers in a short time.
• Versioning of the Zabbix configuration file (Git/SVN).
• Traceability and auditing of changes to the Zabbix configuration file allied to the configuration versioning tool (Git/SVN).
• Backup of the file containing the entire configuration without the need for database backup (database backup is still required for the data, but the configuration can be replicated without necessarily backing up the associated database).
• Readability and documentation of the configuration file (if the YAML standard is used, closer to the human being).
• Standardize the configuration of a Zabbix server suite where possible (even with business specifics).
• Sharing of the expertise used to configure a Zabbix (because the YAML standard, accepts comments to document and better explain why some configurations).
• Provides work with more customers and Zabbix configuration projects in a shorter time frame than currently.
• Consistency with DevOps and Agile cultures, configuration management (ITIL), and automation requirements.
• Enables the Zabbix configuration to be managed as code rather than the basis for mouse clicks, as it is today.
 
Requirements:
 
• Zabbix must export the hashed passwords (MD5 / SHA256 / SHA512) and not plain text in the configuration file;
• Images registered in Zabbix can also be exported/imported in base64 in the configuration file;
• Do the syntax handling of the configuration file;
• Create documentation so that external plugins and services can fit the syntax to have the exported configuration as well;
 
Projects that already use this idea: Jenkins [3] [4]

Example of a file used by Jenkins. [5]
 
By loading this configuration file, Jenkins not only reads the plugins settings but also installs the required plugins as they are quoted in the file. So you really know what you have and how it's set up at Jenkins. The idea would be to make this parallel in Zabbix.

 



 Comments   
Comment by alex dekker [ 2018 Nov 19 ]

I like the idea of being able to quickly deploy a known-good "base config" of Zabbix, without having to manually recreate stuff like regular expressions. I would see this as a continuation of the existing XML import/export functionality.

Comment by alex dekker [ 2018 Nov 19 ]

Also, could be used to migrate between DBs where you don't care about historic data.

Comment by richlv [ 2018 Nov 19 ]

This is essentially a duplicate of ZBXNEXT-2101.

Comment by Burov Alexey [ 2019 Apr 01 ]

Zabbix as Code - great idea! First step is "Save all object as yaml" - ZBXNEXT-4862

We implemented a similar mechanism in third-party toolkit https://gitlab.com/devopshq/zabbix-review-export, But it would be more convenient to have a built-in mechanism.

Comment by Aecio Pires [ 2019 Apr 01 ]

Thank you @Burov!

You understood my suggestion perfectly with ZCasC. I saw the code you implemented.

I will be showing this idea and his project in the talk: "Managing Zabbix with Terraform" during https://conference.zabbix.com.br/en/agenda/ in Brazil in the presence of @Alexei Vladishev. I have hope to draw attention to this theme.

Comment by Aecio Pires [ 2019 Apr 30 ]

 

@Burov Alexey, I presented this idea for @avladishev at Zabbix Conference Latam 2019 in Brazil and I presented a use case of Zabbix deploy with Terraform and I cited the work that you did at https://gitlab.com/ devopshq/zabbix-review-export See the slides: https://www.slideshare.net/aeciopires/management-zabbix-with-terraform 

 

Alexei was interested in implementing this in the long run and this work will start in Zabbix 4.4 where he already showed that it is in the Roadmap to leave templates, items and triggers in the YAML pattern instead of XML.

Comment by Burov Alexey [ 2019 Apr 30 ]

@aeciopires great news, thanks you! We look forward to Zabbix 4.4

Comment by patrik uytterhoeven [ 2019 Oct 02 ]

i suppose this is moved to 5.0 as i don't see any progress for 4.4 ?

Comment by Aecio Pires [ 2019 Oct 02 ]

@patrik no progress of this functionality in Zabbix 4.4. Maybe in 5.0.

Comment by Denis Kot [ 2019 Oct 02 ]

I'm +1 for support Zabbix in Terraform. What Terraform (or provider) does is makes API calls to, i.e. AWS API. So all we need is Zabbix provider to Terraform.

Comment by Aecio Pires [ 2019 Oct 02 ]

Hello @Denis!

There is this provider for Terraform https://github.com/dainis/terraform-provider-zabbix

But the terraform provider does not replace ZCasC functionality... the terraform provider is very welcome while ZCasC is not implemented.

Note that the provider needs more developers to improve the quality and quantity of methods that make use of the Zabbix API.

I could help but I don't know how to program in Go https://golang.org/

Comment by Multazim Deshmukh [ 2020 Mar 14 ]

As Zabbix API doesn't provide ability to export following sections so it should be added first.

Configuration: Actions, Event correlation, Discovery, Services
Administration: General, Proxies, Authentication, User groups, Users, Scripts

Generated at Thu Apr 18 05:08:21 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.