Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
ansible-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
ansible-scripts
Commits
faeb8aa8
Commit
faeb8aa8
authored
11 months ago
by
Jonas Leder
Browse files
Options
Downloads
Patches
Plain Diff
add mysql exporter install playbook
parent
8ca277a3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
linux/debian/files/mysqld_exporter.service
+14
-0
14 additions, 0 deletions
linux/debian/files/mysqld_exporter.service
linux/debian/install-mysql-exporter.yml
+54
-0
54 additions, 0 deletions
linux/debian/install-mysql-exporter.yml
with
68 additions
and
0 deletions
linux/debian/files/mysqld_exporter.service
0 → 100644
+
14
−
0
View file @
faeb8aa8
[Unit]
Description
=
MySQL Metrics Exporter for Prometheus
After
=
network.target
Wants
=
network-online.target
[Service]
Restart
=
always
Type
=
simple
User
=
mysql
ExecStart
=
/usr/local/bin/mysqld_exporter
Environment
=
[Install]
WantedBy
=
multi-user.target
\ No newline at end of file
This diff is collapsed.
Click to expand it.
linux/debian/install-mysql-exporter.yml
0 → 100644
+
54
−
0
View file @
faeb8aa8
-
name
:
Install Prometheus node exporter
hosts
:
all
vars
:
mysqld_exporter_version
:
1.15.1
arch
:
"
{%
if
ansible_architecture
==
'x86_64'
%}amd64{%
elif
ansible_architecture
==
'aarch64'
%}arm64{%
endif
%}"
tasks
:
-
name
:
uninstall mysqld-exporter package
apt
:
name
:
prometheus-mysqld-exporter
state
:
absent
purge
:
yes
autoremove
:
yes
-
name
:
download mysqld-exporter release
get_url
:
url
:
"
https://github.com/prometheus/mysqld_exporter/releases/download/v{{
mysqld_exporter_version
}}/mysqld_exporter-{{
mysqld_exporter_version
}}.linux-{{
arch
}}.tar.gz"
dest
:
/tmp/mysqld_exporter.tar.gz
-
name
:
extract mysqld-exporter release
unarchive
:
src
:
/tmp/mysqld_exporter.tar.gz
dest
:
/tmp
remote_src
:
yes
-
name
:
delete old binary if exists
file
:
path
:
/usr/local/bin/mysqld_exporter
state
:
absent
-
name
:
move mysqld-exporter binary
shell
:
cp /tmp/mysqld_exporter-{{ mysqld_exporter_version }}.linux-{{ arch }}/mysqld_exporter /usr/local/bin/mysqld_exporter
-
name
:
install systemd-service
copy
:
src
:
files/mysqld_exporter.service
dest
:
/etc/systemd/system/mysqld_exporter.service
mode
:
0644
-
name
:
reload systemd
systemd
:
daemon_reload
:
yes
-
name
:
enable mysqld-exporter service
systemd
:
name
:
mysqld_exporter
enabled
:
yes
state
:
started
-
name
:
delete temporary files
file
:
path
:
/tmp/mysqld_exporter*
state
:
absent
-
name
:
check mysqld-exporter status
uri
:
url
:
http://localhost:9104/metrics
status_code
:
200
timeout
:
5
return_content
:
yes
register
:
mysqld_exporter_status
until
:
mysqld_exporter_status.status ==
200
retries
:
5
delay
:
5
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment