Skip to content

Commit 903f752

Browse files
committed
fix: Updating mysql exporter to better monitor slave status (#965)
(cherry picked from commit 54f8606)
1 parent d5572cb commit 903f752

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

base-helm-configs/prometheus-mysql-exporter/values.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ serviceMonitor:
4747
# Set relabel_configs as per https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
4848
relabelings: []
4949
multipleTarget:
50-
enabled: false
50+
enabled: true
5151
targets:
5252
# target connection information with name (required), endpoint (required) and port (optionnal)
5353
# if sharedSecret is not enabled the name must match an entry client.{{ name }} existing in the secret
@@ -56,10 +56,16 @@ serviceMonitor:
5656
# port: 3307
5757
# - endpoint: mysql2.dns.local
5858
# name: mysql2
59+
- endpoint: mariadb-cluster-0.mariadb-cluster-internal
60+
name: maria0
61+
- endpoint: mariadb-cluster-1.mariadb-cluster-internal
62+
name: maria1
63+
- endpoint: mariadb-cluster-2.mariadb-cluster-internal
64+
name: maria2
5965
# Enable shared credentials for all targets
6066
sharedSecret:
61-
enabled: false
62-
name: ""
67+
enabled: true
68+
name: "mariadb-monitor"
6369

6470
serviceAccount:
6571
# Specifies whether a ServiceAccount should be created
@@ -81,7 +87,8 @@ resources: {}
8187
# cpu: 100m
8288
# memory: 128Mi
8389

84-
nodeSelector: {}
90+
nodeSelector:
91+
openstack-control-plane: enabled
8592

8693
tolerations: []
8794

@@ -159,7 +166,7 @@ collectors:
159166
# perf_schema.indexiowaits: false
160167
# perf_schema.tableiowaits: false
161168
# perf_schema.tablelocks: false
162-
# perf_schema.replication_group_member_stats: false
169+
perf_schema.replication_group_member_stats: true
163170
# slave_status: true
164171
# slave_hosts: false
165172
# heartbeat: false
@@ -169,7 +176,7 @@ collectors:
169176
# mysql connection params which build the my.cnf config
170177
mysql:
171178
db: ""
172-
host: "mariadb-cluster"
179+
host: ""
173180
# config my.cnf https://dev.mysql.com/doc/c-api/8.0/en/mysql-options.html
174181
additionalConfig:
175182
# - connect-timeout=5
@@ -180,8 +187,8 @@ mysql:
180187
user: "monitoring"
181188
# secret with full config my.cnf
182189
existingConfigSecret:
183-
name: ""
184-
key: ""
190+
name: "mariadb-monitor"
191+
key: "my.conf"
185192
# secret only containing the password
186193
existingPasswordSecret:
187194
name: "mariadb-monitoring"

base-kustomize/prometheus-mysql-exporter/base/monitoring_user_grant.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ spec:
99
- "SELECT"
1010
- "PROCESS"
1111
- "REPLICATION CLIENT"
12+
- "SLAVE MONITOR"
1213
database: "*"
1314
table: "*"
1415
username: monitoring

docs/prometheus-mysql-exporter.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ kubectl --namespace openstack \
1919
--from-literal=password="$(< /dev/urandom tr -dc _A-Za-z0-9 | head -c${1:-64};echo;)"
2020
```
2121

22+
Then add the config to a secret that'll be used within the container for our shared services
23+
``` shell
24+
kubectl -n openstack create secret generic mariadb-monitor --type Opaque --from-literal=my.cnf="[client.monitoring]
25+
user=monitoring
26+
password=$(kubectl --namespace openstack get secret mariadb-monitoring -o jsonpath='{.data.password}' | base64 -d)"
27+
```
28+
2229
Next, install the exporter
2330

2431
``` shell

0 commit comments

Comments
 (0)