Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 37 additions & 38 deletions integrations/mysql/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,46 @@ 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
minimum_exporter_version: v0.15.0
Comment thread
algchoo marked this conversation as resolved.
Outdated
multiple_dashboards: false
dashboard_display_name: {{app_name_short}} Prometheus Overview
config_mods: |
apiVersion: apps/v1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the other example, we can update https://github.com/GoogleCloudPlatform/prometheus-engine/blob/main/examples/mysql/exporter.yaml.snippet directly (after addressing the other comments here)

But unlike the consul example, this PR doesn't become completely obsolete -- we do still need to update this file because of the change you made in line 70 (additional_install_info).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, just for clarity I wanted to make sure that the line you're mentioning here doesn't need to be changed? We just want to update things in this repo and the other one, right?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

kind: StatefulSet
apiVersion: v1
kind: ConfigMap
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.14.0
+ env:
+ - name: DATA_SOURCE_NAME
+ value: root:password@(localhost:3306)/
+ ports:
+ - containerPort: 9104
+ name: prometheus
- image: mysql:5.7
Comment thread
algchoo marked this conversation as resolved.
name: mysql
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
name: mysql
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried applying this yaml and got

create Pod mysql-0 in StatefulSet mysql failed error: Pod "mysql-0" is invalid: spec.containers[1].volumeMounts[0].name: Not found: "mysql-exporter-config"

Looks like we need to define a volume that corresponds to the volumeMount?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the yaml to include a volumeMount and I'm wondering, do we want the + symbols with the configmap that is included in the example as well?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so.

In some cases like the nginx one, you can reasonably expect that anyone setting up nginx on k8s will have a configmap set up, so we just use "+"s to indicate the lines they need to add to the config map.

In this case, if you already had a mysql instance up and running, and then you were adding an exporter, you wouldn't already have a configmap with credentials beforehand, so the volume, volumemount, configmap are all indicated with "+"s.

Does that make sense?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so, I pushed changes to include the + symbols with the configmap unsure if we need all of them.

podmonitoring_config: |
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
Expand All @@ -68,7 +67,7 @@ podmonitoring_config: |
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 `DATA_SOURCE_NAME` environment variable with credentials that work with your {{app_name}} instance.
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
Expand Down
2 changes: 1 addition & 1 deletion integrations/mysql/prometheus_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ platforms:
exporter_metadata:
name: MySQL Prometheus Exporter
doc_url: https://github.com/prometheus/mysqld_exporter
minimum_supported_version: v0.14.0
minimum_supported_version: v0.15.0
default_metrics:
- name: prometheus.googleapis.com/mysql_global_status_uptime/unknown:counter
prometheus_name: mysql_global_status_uptime
Expand Down