integrations/mysql/documentation.yaml (117 lines of code) (raw):
exporter_type: sidecar
app_name_short: MySQL
app_name: {{app_name_short}}
app_site_name: MySQL
app_site_url: https://www.mysql.com/
exporter_name: the MySQL exporter
exporter_pkg_name: mysqld_exporter
exporter_repo_url: https://github.com/prometheus/mysqld_exporter
dashboard_available: true
minimum_exporter_version: v0.14.0
multiple_dashboards: false
dashboard_display_name: {{app_name_short}} Prometheus Overview
config_mods: |
+ apiVersion: v1
+ kind: ConfigMap
+ metadata:
+ name: mysql-exporter-config
+ data:
+ my.cnf: |
+ [client]
+ user=root
+ password=password
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql
spec:
serviceName: mysql
selector:
matchLabels:
+ app.kubernetes.io/name: mysql
template:
metadata:
labels:
+ app.kubernetes.io/name: mysql
spec:
containers:
+ - name: exporter
+ image: prom/mysqld-exporter:v0.15.0
+ args:
+ - --config.my-cnf=/home/my.cnf
+ ports:
+ - containerPort: 9104
+ name: prometheus
+ volumeMounts:
+ - mountPath: /home/my.cnf
+ subPath: my.cnf
+ name: mysql-exporter-config
- name: mysql
image: mysql:5.7
env:
- name: MYSQL_ROOT_PASSWORD
value: password
- name: MYSQL_USER
value: sbtest
- name: MYSQL_PASSWORD
value: password
- name: MYSQL_DATABASE
value: sbtest
ports:
- containerPort: 3306
+ volumes:
+ - name: mysql-exporter-config
+ configMap:
+ name: mysql-exporter-config
+ items:
+ - key: my.cnf
+ path: my.cnf
podmonitoring_config: |
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
name: mysql
labels:
app.kubernetes.io/name: mysql
app.kubernetes.io/part-of: google-cloud-managed-prometheus
spec:
endpoints:
- port: prometheus
scheme: http
interval: 30s
path: /metrics
selector:
matchLabels:
app.kubernetes.io/name: mysql
additional_prereq_info: |
For information about creating a least-privileged user, see [Required Grants](https://github.com/prometheus/mysqld_exporter#required-grants){:class=external}.
additional_install_info:
Update the `--config.my-cnf` argument with a path to a configuration file with credentials that work with your {{app_name}} instance
sample_promql_query: up{job="mysql", cluster="{{cluster_name}}", namespace="{{namespace_name}}"}
alerts_config: |
apiVersion: monitoring.googleapis.com/v1
kind: Rules
metadata:
name: mysql-rules
labels:
app.kubernetes.io/component: rules
app.kubernetes.io/name: mysql-rules
app.kubernetes.io/part-of: google-cloud-managed-prometheus
spec:
groups:
- name: mysql
interval: 30s
rules:
- alert: MySQLConnectionErrors
annotations:
description: |-
MySQL connection errors
VALUE = {{ $value }}
LABELS: {{ $labels }}
summary: MySQL connection errors (instance {{ $labels.instance }})
expr: mysql_global_status_connection_errors_total > 0
for: 5m
labels:
severity: warning
additional_alert_info: You can adjust the alert thresholds to suit your application.