chef / automate

Chef Automate provides a full suite of enterprise capabilities for maintaining continuous visibility into application, infrastructure, and security automation.
https://automate.chef.io/
Apache License 2.0
224 stars 111 forks source link

Implement config driven LMM. #5231

Open punitmundra opened 3 years ago

punitmundra commented 3 years ago

Description

Implement config driven LMM enablement in a2ha.rb file (Both for exisiting and AWS) - For Automate FE - Base Story

Need to add logic of installing Journal beat and Metrcis beat in case LMM is enabled in a2ha.rb config file.

Need to add this logic in below ruby service: https://github.com/chef/a2-ha-backend/tree/master/components/automate-cluster-ctl

Changes in the autocluster-ctl deploy cmd to consume the config. - Logic for actions around enabling and disabling of LMM and ELK. - Error handling and existing flow should not break.

Acceptance Criteria

automate-cluster-ctl service should reach a capability of installtion two beats based on the flag consumed from a2ha.rb file. Customer should get LMM disabled flag by default in .rb file and should have option to edit the same.

Remark

Be may opt for prometheus as well for LMM in case we find that route easier in adoption

Aha! Link: https://chef.aha.io/epics/SH-E-645

meet58 commented 2 years ago

Behaviour: "automate-cluster-ctl config init -a existing_nodes/aws" will create a2ha.rb including lmm configuration as mentioned below. Then "automate-cluster-ctl deploy" will create terraform.tfvars, It will also reflect a2ha.rb config's as a terraform variable. That terraform variables then can be used to handle elk installation based on value. “logging_monitoring_management : true” this value also will be reflected into config.toml file so during deployment changes will be placed and we can turn on/off default logging.

####Logic for LMM configuration


LMM disable

    same as current flow 

LMM enable

    elk false 

            cust need to give url / pwd / port / cert  

    elk true 

            we will get from our terraform scrip 

###Logic will be implemented in a2ha.rb file.

--------------------------------------------------a2ha.rb----------------------------------------------------

If you want to enable default monitoring for automate and chef-server then leave it true otherwise make it false.

logging_monitoring_management: true

###If LMM is true then if you want to create a new elk then leave it true otherwise make it false.

elk: true

If you want to use your already installed or configured ELK stack then make elk false for above line and provide your elk instance settings. below.

elk_instance_id=

elk_port=

elk_cert=

elk_username=

elk_password=


###terraform.tfvars will look like this. This file would be generated when deployment command get executed. Above settings will be reflected here. And using these variables we have to create elk stack.

------------------------------------------------------------terraform.tfvars-------------------------------------------------------

logging_monitoring_management = "true"

elk = "true"

elk_instance_id = ""

elk_port = ""

elk_cert = ""

elk_username = ""

elk_password = ""


meet58 commented 2 years ago

To achieve enabling disabling this feature we should be able to enable/disable journalbeat-metricbeat config from config.toml file. Also we need to add elk configuration (ip,port,uname,password etc..)

Config will look like this:

[journalbeat-metricbeat]
   enable = true
   nodes  = [10.0.1.1:9200, 10.01.2:9200,10.0.1.3:9200]
   username = 'admin'
   password = 'plojhdfgert'

Based on above value, automate-backend-ctl command will set value based on user inputs.

scenario 1: User will set below options lmm: true elk: false They want use default logging and don't want separate elk.

scenario 2: User will set below options lmm : true elk : true Need to create elk and supply configuration detail to config.toml.

scenario 3: User will set below options lmm:true elk:false elk_ip: elk_port: elk_username: elk_password:

User wants to use their own elk. In this case also we need to supply above configuration details to config.toml

So on last 2 scenario, we have to supply configuration to config.toml as we defined above

meet58 commented 2 years ago

Done necessary changes on my branch. https://github.com/chef/a2-ha-backend/tree/meet58/lmm-changes

meet58 commented 2 years ago

Created a PR: https://github.com/chef/a2-ha-backend/pull/492