Install MySQL Monitors, the App and view the Dashboards
This page has instructions for installing Sumo Logic Monitors for MySQL, the app and descriptions of each of the app dashboards. These instructions assume you have already set up collection as described in the Collect MySQL Logs and Metrics (Kubernetes/Non-Kubernetes) page.
Install Monitors
Sumo Logic has provided pre-packaged alerts available through Sumo Logic monitors to help you proactively determine if a MySQL cluster is available and performing as expected. These monitors are based on metric and log data and include pre-set thresholds that reflect industry best practices and recommendations. For more information about individual alerts, see MySQL Alerts.
To install these monitors, you must have the Manage Monitors role capability.
You can install monitors by importing a JSON file or using a Terraform script.
Method 1: Install Monitors by importing a JSON file
- Download the JSON file that describes the monitors.
- Replace
$$mysql_data_source
with a custom source filter. To configure alerts for a specific database cluster, use a filter likedb_system=mysql
ordb_cluster=dev-mysql
. To configure the alerts for all of your clusters, set$$mysql_data_source
to blank (""). - Go to Manage Data > Alerts > Monitors.
- Click Add.
- Click Import.
- On the Import Content popup, enter "MySQL" in the Name field, paste in the JSON into the the popup, and click Import.
- The monitors are created in a "MySQL" folder. The monitors are disabled by default. See the Monitors topic for information about enabling monitors and configuring notifications or connections.
Method 2: Install Monitors using a Terraform script
Step 1: Generate a Sumo Logic access key and ID
Generate an access key and access ID for a user that has the Manage Monitors role capability. For instructions see Access Keys.
Step 2: Download and install Terraform
Download Terraform 0.13 or later, and install it.
Step 3: Download the Sumo Logic Terraform package for MySQL monitors
The alerts package is available in the Sumo Logic github repository. You can either download it using the git clone
command or as a zip file.
Step 4: Alert Configuration
After extracting the package , navigate to the terraform-sumologic-sumo-logic-monitor/monitor_packages/mysql/
directory.
Edit the mysql.auto.tfvars
file and add the Sumo Logic Access Key and Access ID from Step 1 and your Sumo Logic deployment. If you're not sure of your deployment, see Sumo Logic Endpoints and Firewall Security.
access_id = "<SUMOLOGIC ACCESS ID>"
access_key = "<SUMOLOGIC ACCESS KEY>"
environment = "<SUMOLOGIC DEPLOYMENT>"
The Terraform script installs the alerts without any scope filters, if you would like to restrict the alerts to specific clusters or environments, update the mysql_data_source
variable. For example:
To configure alerts for... | Set mysql_data_source to something like... |
---|---|
A specific cluster | db_cluster=mysql.prod.01 |
All clusters in an environment | environment=prod |
Multiple clusters using a wildcard | db_cluster=mysql-prod* |
A specific cluster within a specific environment | db_cluster=mysql-1 and environment=prod This assumes you have configured and applied Fields as described in Step 1: Configure Fields of the Sumo Logic of the Collect Logs and Metrics for MySQL topic. |
All monitors are disabled by default on installation. To enable all of the monitors, set the monitors_disabled
parameter to false.
By default, the monitors will be located in a "MySQL" folder on the Monitors page. To change the name of the folder, update the monitor folder name in the folder
variable in the mysql.auto.tfvars
file.
If you want the alerts to send email or connection notifications, follow the instructions in the next section.
Step 5: Email and Connection Notification Configuration Examples
Edit the mysql_notifications.auto.tfvars
file to populate the connection_notifications
and email_notifications
sections. Examples are provided below.
Pagerduty connection example
In the variable definition below, replace <CONNECTION_ID>
with the connection ID of the Webhook connection. You can obtain the Webhook connection ID by calling the Monitors API.
connection_notifications = [
{
connection_type = "PagerDuty",
connection_id = "<CONNECTION_ID>",
payload_override = "{\"service_key\": \"your_pagerduty_api_integration_key\",\"event_type\": \"trigger\",\"description\": \"Alert: Triggered {{TriggerType}} for Monitor {{Name}}\",\"client\": \"Sumo Logic\",\"client_url\": \"{{QueryUrl}}\"}",
run_for_trigger_types = ["Critical", "ResolvedCritical"]
},
{
connection_type = "Webhook",
connection_id = "<CONNECTION_ID>",
payload_override = "",
run_for_trigger_types = ["Critical", "ResolvedCritical"]
}
]
Email notifications example
email_notifications = [
{
connection_type = "Email",
recipients = ["abc@example.com"],
subject = "Monitor Alert: {{TriggerType}} on {{Name}}",
time_zone = "PST",
message_body = "Triggered {{TriggerType}} Alert on {{Name}}: {{QueryURL}}",
run_for_trigger_types = ["Critical", "ResolvedCritical"]
}
]
Step 6: Install Monitors
- Navigate to the
terraform-sumologic-sumo-logic-monitor/monitor_packages/mysql/
directory and runterraform init
. This will initialize Terraform and download the required components. - Run
terraform plan
to view the monitors that Terraform will create or modify. - Run
terraform apply
.
Install the Sumo Logic App
Now that you have set up collection for MySQL, install the Sumo Logic App for MySQL to use the preconfigured searches and Dashboards that provide insight into your data.
To install the app
Locate and install the app you need from the App Catalog. If you want to see a preview of the dashboards included with the app before installing, click Preview Dashboards.
- From the App Catalog, search for and select the app.
- Select the version of the service you're using and click Add to Library.
- To install the app, complete the following fields.
- App Name. You can retain the existing name, or enter a name of your choice for the app.
- Data Source. Choose Enter a Custom Data Filter, and enter a custom filter. For example:
- For all MySQL clusters:
db_system=mysql db_cluster=*
- For a specific cluster:
db_system=mysql db_cluster=mysql.dev.01
- For all MySQL clusters:
- Advanced. Select the Location in Library (the default is the Personal folder in the library), or click New Folder to add a new folder.
- Click Add to Library.
Once an app is installed, it will appear in your Personal folder, or other folder that you specified. From here, you can share it with your organization.
Panels will start to fill automatically. It's important to note that each panel slowly fills with data matching the time range query and received since the panel was created. Results won't immediately be available, but with a bit of time, you'll see full graphs and maps.
Filter with template variables
Template variables provide dynamic dashboards that can re-scope data on the fly. As you apply variables to troubleshoot through your dashboard, you view dynamic changes to the data for a quicker resolution to the root cause. For more information, see the Filter with template variables help page. You can use template variables to drill down and examine the data on a granular level.
Dashboards
Overview Dashboard
The Overview dashboard gives you an at-a-glance view of the state of your database clusters by monitoring key cluster information such as errors, failed logins, errors, queries executed, slow queries, lock waits, uptime and more.
Use this dashboard to:
- Quickly identify the state of a given database cluster
Error Logs Dashboard
The Error Logs dashboard provides insight into database error logs by specifically monitoring database shutdown/start events, errors over time, errors, warnings and crash recovery attempts.
Use this dashboard to:
- Quickly identify errors and patterns in logs for troubleshooting
- Monitor trends in error logs and identify outliers
- Ensure that server start, server stop and crash recovery events are in line with expectations
- Dashboard filters allow you to narrow a search for database cluster.
Failed Logins Dashboard
The Failed Logins dashboard provides insights into all failed login attempts by location, users and hosts.
Use this dashboard to:
- Monitor all failed login attempts and identify any unusual or suspicious activity
Replication Dashboard
The Replication dashboard provides insights into the state of database replication.
Use this dashboard to:
- Quickly determine reasons for replication failures
- Monitor replication status trends
Slow Queries Dashboard
The Slow Queries dashboard provides insights into all slow queries executed on the database.
Note: Slow queries are queries that take 10 seconds or more to execute (default value is 10 seconds as per mysql configuration which can be altered) and excessive slow queries are those that take 15 seconds or more to execute.
Use this dashboard to:
- Identify all slow queries
- Quickly determine which queries have been identified as slow or excessive slow queries
- Monitor users and hosts running slow queries
- Determine which SQL commands are slower than others
- Examine slow query trends to determine if there are periodic performance bottlenecks in your database clusters
Performance and Resource Metrics dashboard
The Performance and Resource Metrics dashboard allows you to monitor the performance and resource usage of your database clusters.
Use this dashboard to:
- Understand the behavior and performance of your database clusters
- Monitor key operational metrics around connections, network traffic, threads running, innodb waits and locks.
- Monitor query execution trends to ensure they match up with expectations
- Dashboard filters allow you to narrow a search for a specific database cluster
Performance Schema Metrics
The Performance Schema Metrics Dashboard provides insights into the metrics provided by the MySQL Performance Schema, which is a feature for monitoring MySQL Server execution at a low level.
Use this dashboard to:
- Monitor errors and warning for SQL statements
- Monitor statements running without use of index columns
- Monitor statistics such as Table and Index waits and read and write lock waits to optimize the performance of your database