Data Collection Alert Module
Real-time monitoring and alerting for data collection processes with the DCAM.
Introduction#
The Data Collection Alert Module is a component integrated into our data management infrastructure. Its purpose is to provide real-time monitoring and alerting capabilities for data collection processes. The DCAM plays a pivotal role in ensuring the integrity, completeness, and accuracy of data collected from diverse sources.
Pre-requisites#
Before deploying the Data Collection Alert Module, ensure that the following prerequisite checks and configurations are in place.
1. Port 8085 Availability: Check whether port 8085 is already in use and listening on the target server. If it's occupied, select an alternative port.
If port 8085 is available, proceed to enable it using the following commands on the HEAL server where the image will be loaded:
firewall-cmd --permanent --zone=public --add-port=8085/tcp
firewall-cmd --reload
2. Consul Key Values: Retrieve the necessary Consul key values for user and group settings from the keys below:
consul kv get service/users/groupid
consul kv get service/users/userid
Note: These values will be used while starting the module.
3. Certificate Import: Ensure that the required certificate is available at the following location on the HEAL server before loading the Data Collection Alert Module image.
<Installation_Path>/Appsone_Service/data/cert/cacerts
4. Nomad File Network Mode: Check the network mode specified in the Nomad file configuration. Ensure it aligns with your network requirements for the Data Collection Alert Module.
5. To Initiate the Container: To start the Data Collection Alert Module container, execute the following command.
Replace the placeholders with the appropriate values:
docker run -d -e UID=<userid_value> -e GID=<groupid_value> -e NOMAD_IP=<heal_server_ip> -e CONSUL_URL="<heal_server_ip>:8501" -it --name="datacollection-alert" -p 8085:8085 --network=<network_mode> -v "<installation_path>/Heal/Appsone_Service/data/cert/cacerts:/etc/ssl/certs/java/cacerts" -v "<image_loaded_path>/logs/:/opt/datacollection-alerts/logs/:z" datacollection-alerts:2.1.0
Note: Ensure all values are correctly updated before executing the command.
6. Log Monitoring: Once the Docker container is started, it will create a 'logs' directory in the specified image-loaded path.
Monitor these logs for any potential errors or issues during operation.
DCAM Deployment Steps#
To successfully deploy the Data Collection Alert Module, follow the steps below:
Note: Ensure that all the prerequisites have been met before proceeding.
1. Copy the "datacollection-alerts_2.1.0.tar" image to any HEAL server.
2. Load the image using the following Docker command:
docker load -i datacollection-alerts_2.1.0.tar
3. Consul Key Update
Update the necessary Consul keys based on your configuration.
Note: If SMTP (Simple Mail Transfer Protocol) is configured without credentials, set the below Consul key 'service/datacollectionalerts/email/smpt_auth' to false.
4. Add the below Consul keys:
consul kv put service/perconadb/driver com.mysql.cj.jdbc.Driver
consul kv put service/perconadb/idleconnections 5
consul kv put service/perconadb/poolsize 50
consul kv put service/perconadb/connectiontimeout 10000
consul kv put service/perconadb/idleconnectiontimeout 600000
consul kv put service/perconadb/maxlifetime 1800000
consul kv put service/datacollectionalerts/threadpool_coresize 5
consul kv put service/datacollectionalerts/threadpool_maxsize 5
consul kv put service/datacollectionalerts/update_interval 60000
consul kv put service/datacollectionalerts/log_interval 10000
consul kv put service/datacollectionalerts/health_enabled true
consul kv put service/datacollectionalerts/webbase_path /measure
consul kv put service/datacollectionalerts/port 8989
consul kv put service/datacollectionalerts/jmx_enabled true
consul kv put service/datacollectionalerts/recipient_mail
consul kv put service/datacollectionalerts/instance_alert_schedule_interval_minutes 5
consul kv put service/datacollectionalerts/custom_instance_alert_schedule_interval_minutes 5
consul kv put service/datacollectionalerts/check_all_instance_time_interval_minutes 5
consul kv put service/datacollectionalerts/check_instanceHealth_time_interval_minutes 5
consul kv put service/datacollectionalerts/check_instanceKpiHealth_time_interval_minutes 5
consul kv put service/datacollectionalerts/skip_accIdentifier_forCheck
consul kv put service/datacollectionalerts/timezone IST
consul kv put service/datacollectionalerts/opensearch_index_single_instance data_collection_alert_single_instance
consul kv put service/datacollectionalerts/opensearch_index_multiple_instance data_collection_alert_multiple_instance
consul kv put service/datacollectionalerts/istechdebt true
consul kv put service/datacollectionalerts/inserts true
consul kv put service/datacollectionalerts/tc_server_port 8083
consul kv put service/datacollectionalerts/logminindex 1
consul kv put service/datacollectionalerts/logmaxindex 10
consul kv put service/datacollectionalerts/logtotalsize 100MB
consul kv put service/datacollectionalerts/loglevel DEBUG
consul kv put service/datacollectionalerts/email/showendtime 1
consul kv put service/datacollectionalerts/email/smpt_auth true
consul kv put service/datacollectionalerts/email/smpt_tls_enable true
consul kv put service/datacollectionalerts/email/smpt_debug true
consul kv put service/datacollectionalerts/email/smpt_ssl_protocol TLSv1.2
consul kv put service/datacollectionalerts/redis/cache/mode 0
consul kv put service/datacollectionalerts/account/configuration/cache/expire/interval/minutes 60
consul kv put service/datacollectionalerts/account/configuration/cache/max/size 500
consul kv put service/datacollectionalerts/master/data/configuration/cache/expire/interval/minutes 60
consul kv put service/datacollectionalerts/master/data/configuration/cache/max/size 500
consul kv put service/datacollectionalerts/opensearch/data/push/schedule/initial/delay 2
consul kv put service/datacollectionalerts/opensearch/data/push/schedule/interval 5
consul kv put service/datacollectionalerts/opensearch/batch/size 50
consul kv put service/datacollectionalerts/opensearch/batch/queue/maxsize 10000
consul kv put service/datacollectionalerts/opensearch/connection/io/reactor/size 2
consul kv put service/datacollectionalerts/opensearch/connection/max/redirects 10
consul kv put service/datacollectionalerts/stats/loglevel DEBUG
Note: Ensure the above keys are updated with their respective values.
5. Configuring Consul Key Updates for Alerts: Update the following configuration in the following Consul keys for alerts:
- Specify the email address(es), separated by commas, to receive alerts in the below consul key.
service/datacollectionalerts/recipient_mail
- Provide account identifiers as a comma-separated list to skip alerts for specific accounts.
service/datacollectionalerts/skip_accIdentifier_forCheck
- Set the desired interval (in minutes) for alerts. The default value is 5 minutes.
service/datacollectionalerts/instance_alert_schedule_interval_minutes
- Set the desired interval (in minutes) for custom alerts. The default value is 5 minutes.
service/datacollectionalerts/custom_instance_alert_schedule_interval_minutes
Alert Configuration in the Database#
This section provides step-by-step instructions for configuring instances and Key Performance Indicators (KPIs) to enable alerting functionality within the database.
1. Start the module and update SMTP details.
a. Ensure that the module is successfully started.
b. Update the SMTP details for the specific accounts that need to be monitored and receive alerts.
2. Log in to Percona to Configure Instances and KPIs.
a. Access the Percona Database: To configure instances and KPIs, log in to the Percona database.
b. New Tables for Alert Configuration: Below are the new tables available after performing a database migration:
- Utilized for monitoring one or multiple instances using a single KPI per instance.
Note: It is not possible to configure monitoring for multiple KPIs on the same instance.
comp_instance_health
- Utilized for monitoring one or multiple instances with multiple KPIs assigned to the same instances.
Note: It is possible to configure monitoring for multiple KPIs on the same instance.
comp_instance_kpis_health
Note: These tables will be utilized for configuring alerts.
3. Update table entries.
a. List the tables to be updated:
comp_instance_health
comp_instance_kpis_health
b. Update the above tables with the following details:
- id: Unique identifier
- comp_instance_id: Select the relevant instance ID from the comp_instance table.
- kpi_id: Select the appropriate KPI ID for the selected instance.
- status: Keep the value as 1. Setting it to 0 will disable email alerts.
- delay_mins: Set to 3/4 minutes by default. Update if KPI data collection occurs at specific intervals.
- create_time: Use the format 'YYYY-MM-DD HH:MM:SS' for the creation timestamp.
- updated_time: Use the format 'YYYY-MM-DD HH:MM:SS' for the update timestamp.
- user_details_id: Use the unique user details ID (for example: 7640123a-fbde-4fe5-9812-581cd1e3a9c1).
4. Activate Alerts
a. Post-Update Actions: After updating the values in the tables, alerts will be sent in case of any data breakage for the specified instance and KPI.
b. By default, the "comp_instance_health" table is configured to check all instances for accounts with SMTP settings; it will send alerts for any random KPI if data is unavailable. To monitor a particular instance, modify the information in the "comp_instance_health" table with any available KPIs for that instance.
Note:
- Setting the status column value to 0 in the comp_instance_health table will prevent alerts from being triggered for that instance. Similarly, alerts will not be triggered for that particular KPI if status is set to 0 in the 'comp_instance_kpis_health' table.
- The 'comp_instance_kpis_health' table should have some entries to receive alerts at the KPI level.
- A stored procedure is available for bulk inserting data into the 'comp_instance_health' table to receive alerts at the instance level. Bulk insertion at the KPI level is client-specific and requires providing data by the client with a combination of application names and required KPI names. These can be processed in-house and shared as SQL files.
Stored Procedure Steps for Instance Level#
Manually inserting data into the table can be time-consuming, especially when dealing with multiple applications and numerous instances. To streamline this process, we are providing a stored procedure that allows you to insert all the necessary data in one go.
This section provides instructions for configuring a stored procedure at the instance level to enable alerts.
1. Navigate to the directory below:
<Installation_Path>/Appsone_Service/migration-db
2. Copy the SQL file below:
insert-comp-instance-health-data-sp.sql
3. Execute the following command:
mysql -h <ip> -u dbadmin -p'<password>' -P 3307 --ssl-mode=disabled appsone < insert-comp-instance-health-data-sp.sql
Note: After executing the above command, the stored procedure will be added to the 'appsone' schema.
4. Execute the stored procedure as below:
a. Application Names List: Take a list of application names for which alerts are required.
b. Execute the below command inside Percona:
CALL `insert-comp-instance-health-data-sp`('<Application_name1>,<application_name2>',1);
c. Multiple Applications: You can provide multiple application names separated by commas.
d. Status Value: Set the value to '1' for the applications to be monitored. All instances under those applications will be added to the 'comp_instance_health' table with a status of '1' to receive alerts for the particular account.
e. Deactivate Monitoring: Set the value to '0' for those applications that should not be monitored. This prevents alerts from being generated for instances under those applications.
For example:
- To monitor only instances under 5 applications:
CALL `insert-comp-instance-health-data-sp`('<AppName_1>,<AppName_2>,<AppName_3>,<AppName_4>,<AppName_5>',1);
- If you do not want to monitor instances under 5 applications:
CALL `insert-comp-instance-health-data-sp`('<AppName_1>,<AppName_2>,<AppName_3>,<AppName_4>,<AppName_5>',0);
Note:
- If the status column is set to '0', no alerts will be sent for those instances.
- In the 'comp_instance_health' table, the 'delay_mins' column's default value is 5. Adjust this value based on any delay in UI data compared to real-time data.
5. Execute the command below to start the module.
docker run -d -e UID=<userid_value> -e GID=<groupid_value> -e NOMAD_IP=<heal_server_ip> -e CONSUL_URL="<heal_server_ip>:8501" -it --name="datacollection-alert" -p 8085:8085 --network=<network_mode> -v "<installation_path>/Heal/Appsone_Service/data/cert/cacerts:/usr/local/openjdk-11/lib/security/cacerts" -v "<image_loaded_path>/logs/:/opt/datacollection-alerts/logs/:z" datacollection-alerts:2.1.0
Expected Output:
- If the above command is executed successfully, then there won't be any messages.
- If there is an error, the respective messages will be displayed.
6. A logs directory will be generated once the module starts running.