Introduction

MySQL is a widely used relational database management system known for its performance, reliability, and ease of use. It is commonly used in various applications ranging from web applications to enterprise-level databases.

To monitor the MySQL efficiently, OpenTelemetry MySQL Receiver can be used to fetch key MySQL performance metrics.

Steps to Configure

Step 1: Check for Existing ConfigMap

Run the following command to see if the opsramp-workload-metric-user-config ConfigMap already exists:

kubectl get configmap opsramp-workload-metric-user-config -n <agent-installed-namespace>

Step 2: Create a New ConfigMap (if not available)

If this is your first setup, create a workload-master ConfigMap. Use the following template and update it as per your workload requirements:

apiVersion: v1
kind: ConfigMap
metadata:
  name: opsramp-workload-metric-user-config
  namespace: opsramp-agent
data:
  workloads: |
    mysql:
    - name: mysql1
      userName: 
        source: value
        value: username
      password: 
        source: value 
        value: password 
      port: 
        source: value 
        value: '3306' 
      targetPodSelector: 
        matchLabels: 
          - key: app 
            operator: exists
            value: 
              - mysql

Step 3: Apply the ConfigMap

kubectl apply -f <path-to-your-manifest-file>

Step 4: Verify in OpsRamp Portal

After a few minutes, check metrics in the OpsRamp Portal > Dashboards > Dashboard.

Step 5: Set Up Alerts and Availability Rules

Once metrics are visible, you can configure alerts and availability rules in the OpsRamp portal. Edit the relevant ConfigMaps to adjust workload or application-specific monitoring.

Supported Metrics

Supported metrics for this workload as provided by the Kubernetes 2.0 Agent.

MetricDescription
mysql_buffer_pool_data_pagesNumber of data pages in the MySQL buffer pool.
mysql_buffer_pool_operationsTotal number of operations performed on the MySQL buffer pool.
mysql_buffer_pool_page_flushesNumber of page flush operations performed on the MySQL buffer pool.
mysql_buffer_pool_pagesTotal number of pages in the MySQL buffer pool.
mysql_buffer_pool_usagePercentage of the MySQL buffer pool that is currently in use.
mysql_double_writesNumber of double writes performed in MySQL, typically related to crash recovery operations.
mysql_handlersNumber of handler operations performed by MySQL (e.g., read, write, etc.).
mysql_locksTotal number of locks held by MySQL.
mysql_log_operationsTotal number of operations performed on the MySQL transaction log.
mysql_mysqlx_connectionsTotal number of active MySQL X protocol connections.
mysql_opened_resourcesNumber of resources (e.g., tables, files) opened by MySQL.
mysql_operationsTotal number of operations executed by MySQL (queries, etc.).
mysql_page_operationsNumber of operations involving pages in MySQL (e.g., read/write operations on pages).
mysql_prepared_statementsNumber of prepared statements in MySQL.
mysql_row_locksTotal number of row-level locks acquired by MySQL.
mysql_row_operationsTotal number of row-level operations (inserts, updates, deletes) performed by MySQL.
mysql_sortsTotal number of sort operations performed by MySQL.
mysql_threadsTotal number of threads currently active in MySQL.
mysql_tmp_resourcesTotal number of temporary resources used by MySQL (e.g., temporary tables, files).
mysql_uptimeTime (in seconds) that the MySQL server has been running since the last restart.