Skip to main content

MySQL

Causely provides native integration with MySQL.

Step 1: Create a user

Create a user for your MySQL database server.

Step 2: Enable performance insights

AWS RDS MySQL

Steps:

  1. Go to RDS Console → Databases
  2. Select your MySQL instance
  3. Click "Modify"
  4. Under "Performance Insights", enable "Enable Performance Insights"
  5. Choose retention period (7 days or more)
  6. Click "Continue" and apply changes immediately

Azure Database for MySQL

Steps:

  1. Go to Azure Portal → Select your Azure Database for MySQL Flexible Server instance.
  2. On the left pane, under Settings, select Server parameters.
  3. For the slow_query_log parameter, select ON.
  4. For the other parameters, such as long_query_time and log_slow_admin_statements, refer to the slow query logs documentation.
  5. Click "Save"

Google Cloud SQL for MySQL

Steps:

  1. Go to Cloud Console → Cloud SQL
  2. Select your MySQL instance
  3. Click "Edit"
  4. Under "Query Insights", enable "Enable Query Insights"
  5. Choose retention period (7 days or more)
  6. Click "Save"

Step 3: Create a Kubernetes Secret for the user

After creating the user create a Kubernetes Secret:

kubectl create secret generic \
--namespace causely mysql-credentials \
--from-literal=db_instance="..." \
--from-literal=username="..." \
--from-literal=password='...' \
--from-literal=host="..." \
--from-literal=port=3306 \
--from-literal=database="..." \
--from-literal=sslmode="..."

The host must be the FQDN of your DB, or IP address if there's no DNS entry set up. It must match the FQDN/IP Causely would discover either from the K8s Server (if it's running in your K8s Cluster) or your Cloud providers API. Examples:

  • Kubernetes: host=my-postgres.namespace.service.cluster.local
  • AWS: host=myinstance.rds.amazonaws.com

If you are leveraging a proxy to connect to your database, like it's common on GCP, host must be the FQDN/IP of your proxy and additionally host_overwrite should be the IP/FQDN of the actual database service: Examples:

  • GCP: host=localhost (assuming proxy runs on the same host / Pod). host_overwrite=1.2.3.4 (the IP of your GCP Cloud SQL instance as shown in the GCP Console)

Step 4: Update Causely Configuration

Once the Secret is created, update the Causely configuration to enable scraping for the new database. Below is an example configuration:

scrapers:
mysql:
enabled: true
instances:
- secretName: mysql-credentials
namespace: causely

Alternative: Enable Credentials Autodiscovery

Causely also supports credentials autodiscovery. This feature allows you to add new scraping targets without updating the Causely configuration. Simply label the Kubernetes Secret to enable autodiscovery for the corresponding scraper.

Example: Labeling Secrets for Autodiscovery

kubectl --namespace causely label secret mysql-credentials "causely.ai/scraper=MySQL"

With these steps, you can seamlessly integrate Causely with MySQL and configure it to monitor your desired resources.