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:
- mysqlNote
Ensure there are no extra spaces at the end of any line in the manifest. Extra spaces can cause rendering issues.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.
| Metric | Description |
|---|---|
| mysql_buffer_pool_data_pages | Number of data pages in the MySQL buffer pool. |
| mysql_buffer_pool_operations | Total number of operations performed on the MySQL buffer pool. |
| mysql_buffer_pool_page_flushes | Number of page flush operations performed on the MySQL buffer pool. |
| mysql_buffer_pool_pages | Total number of pages in the MySQL buffer pool. |
| mysql_buffer_pool_usage | Percentage of the MySQL buffer pool that is currently in use. |
| mysql_double_writes | Number of double writes performed in MySQL, typically related to crash recovery operations. |
| mysql_handlers | Number of handler operations performed by MySQL (e.g., read, write, etc.). |
| mysql_locks | Total number of locks held by MySQL. |
| mysql_log_operations | Total number of operations performed on the MySQL transaction log. |
| mysql_mysqlx_connections | Total number of active MySQL X protocol connections. |
| mysql_opened_resources | Number of resources (e.g., tables, files) opened by MySQL. |
| mysql_operations | Total number of operations executed by MySQL (queries, etc.). |
| mysql_page_operations | Number of operations involving pages in MySQL (e.g., read/write operations on pages). |
| mysql_prepared_statements | Number of prepared statements in MySQL. |
| mysql_row_locks | Total number of row-level locks acquired by MySQL. |
| mysql_row_operations | Total number of row-level operations (inserts, updates, deletes) performed by MySQL. |
| mysql_sorts | Total number of sort operations performed by MySQL. |
| mysql_threads | Total number of threads currently active in MySQL. |
| mysql_tmp_resources | Total number of temporary resources used by MySQL (e.g., temporary tables, files). |
| mysql_uptime | Time (in seconds) that the MySQL server has been running since the last restart. |