mysql: install save_mysql_processlist script

This commit is contained in:
Jérémy Lecour 2020-11-24 13:58:59 +01:00 committed by Jérémy Lecour
parent 1d8b7c3bea
commit 86d59cbb5f
3 changed files with 35 additions and 0 deletions

View File

@ -15,6 +15,7 @@ The **patch** part changes incrementally at each release.
* dovecot: Update munin plugin & configure it * dovecot: Update munin plugin & configure it
* evoacme: variable to disable Debian version check (default: False) * evoacme: variable to disable Debian version check (default: False)
* kvm-host: Add drbd role dependency (toggleable with kvm_install_drbd) * kvm-host: Add drbd role dependency (toggleable with kvm_install_drbd)
* mysql: install save_mysql_processlist script
* nextcloud: New role to setup a nextcloud instance * nextcloud: New role to setup a nextcloud instance
* redis: variable to force use of port 6379 in instances mode * redis: variable to force use of port 6379 in instances mode
* lxc-php: Allow php containers to contact local MySQL with localhost * lxc-php: Allow php containers to contact local MySQL with localhost

View File

@ -0,0 +1,25 @@
#!/bin/sh
set -e
processlist() {
mysqladmin --verbose --vertical processlist
}
DIR="/var/log/mysql-processlist"
TS=`date +%Y%m%d%H%M%S`
FILE="${DIR}/${TS}"
if [ ! -d "${DIR}" ]; then
mkdir -p "${DIR}"
chown root:adm "${DIR}"
chmod 750 "${DIR}"
fi
processlist > "${FILE}"
chmod 640 "${FILE}"
chown root:adm "${FILE}"
find "${DIR}" -type f -mtime +1 -delete
exit 0

View File

@ -178,3 +178,12 @@
tags: tags:
- mysql - mysql
- packages - packages
- name: "Install save_mysql_processlist.sh"
copy:
src: save_mysql_processlist.sh
dest: "{{ mysql_scripts_dir or general_scripts_dir | mandatory }}/save_mysql_processlist.sh"
mode: "0755"
force: no
tags:
- mysql