diff --git a/CHANGELOG.md b/CHANGELOG.md index 38b1cb9b..39766522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ The **patch** part changes is incremented if multiple releases happen the same m * fail2ban: add `fail2ban_sshd_port` variable to configure sshd port * kvm-host: release 23.09.1 for migrate-vm.sh * metricbeat/logstash: fix Ansible syntax +* mysql: new munin graph to follow binlog_days over time * nagios-nrpe: add a NRPE check-local command with completion. * nagios-nrpe: add a proper monitoring plugin for GlusterFS (on servers, not for clients) * php: add new variable to disable overriding settings of php-fpm default pool (www) diff --git a/mysql/files/mysql_binlog_days b/mysql/files/mysql_binlog_days new file mode 100644 index 00000000..ede363cc --- /dev/null +++ b/mysql/files/mysql_binlog_days @@ -0,0 +1,44 @@ +#!/bin/sh + +output_config() { + echo "graph_title MySQL - Value of expire_logs_days variable" + echo "graph_category mysql" + echo "binlogdays.label Number of days of storage of binary logs" + echo "binlogdays.draw AREA" + echo 'graph_args -l 0' + echo 'graph_scale no' +} + +output_values() { + printf "binlogdays.value %d\n" $(binlog_days) +} + +binlog_days() { + mysql --skip-column-names --silent --execute "show variables like 'expire_logs_days';" | awk '{print $2}' +} + +output_usage() { + printf >&2 "%s - munin plugin to graph value of MySQL expire_logs_days system variable\n" ${0##*/} + printf >&2 "Usage: %s [config]\n" ${0##*/} +} + +case $# in + 0) + output_values + ;; + 1) + case $1 in + config) + output_config + ;; + *) + output_usage + exit 1 + ;; + esac + ;; + *) + output_usage + exit 1 + ;; +esac diff --git a/mysql/tasks/munin.yml b/mysql/tasks/munin.yml index 9b4e9617..dfe959c1 100644 --- a/mysql/tasks/munin.yml +++ b/mysql/tasks/munin.yml @@ -66,6 +66,15 @@ - replication notify: restart munin-node + - name: Install custom plugin for binlog retention tracking + ansible.builtin.copy: + src: mysql_binlog_days + dest: /etc/munin/plugins/mysql_binlog_days + owner: root + group: root + mode: "0755" + notify: restart munin-node + - name: verify Munin configuration for mysql < Debian 11 ansible.builtin.replace: dest: /etc/munin/plugin-conf.d/munin-node