Update to 2020-06-04 18:00

master
Daniel Berteaud 5 years ago
parent ecc21f166c
commit 118b420663
  1. 2
      roles/zabbix_server/defaults/main.yml
  2. 30
      roles/zabbix_server/templates/pre_backup.sh.j2

@ -52,6 +52,6 @@ zabbix_server_auth_http: False
# zabbix_server_matrix_access_token: ...
# Zabbix DB can be huge. If zabbix_server_backup_on_full_only is true
# pre-backup will skip history tables from the dump. Except is called with
# pre-backup will skip history tables from the dump. Except if called with
# pre-backup full
zabbix_server_backup_on_full_only: False

@ -14,25 +14,27 @@ mkdir -p /home/lbkp/zabbix
{% if zabbix_server_backup_on_full_only %}
if [[ "$1" == "full" ]]; then
/usr/bin/mysqldump --user={{ zabbix_server_db_user | quote }} \
--password={{ zabbix_server_db_pass | quote }} \
--host={{ zabbix_server_db_server | quote }} \
--port={{ zabbix_server_db_port }} \
--no-create-info \
--quick --single-transaction \
--add-locks \
{{ zabbix_server_db_name | quote }} | zstd -T0 -c > /home/lbkp/zabbix/{{ zabbix_server_db_name }}_data.sql.zst
--password={{ zabbix_server_db_pass | quote }} \
--host={{ zabbix_server_db_server | quote }} \
--port={{ zabbix_server_db_port }} \
--no-create-info \
--quick --single-transaction \
--add-locks \
{{ zabbix_server_db_name | quote }} | zstd -T0 -c > /home/lbkp/zabbix/{{ zabbix_server_db_name }}_data.sql.zst
else
{% endif %}
/usr/bin/mysqldump --user={{ zabbix_server_db_user | quote }} \
--password={{ zabbix_server_db_pass | quote }} \
--host={{ zabbix_server_db_server | quote }} \
--port={{ zabbix_server_db_port }} \
--no-create-info \
--password={{ zabbix_server_db_pass | quote }} \
--host={{ zabbix_server_db_server | quote }} \
--port={{ zabbix_server_db_port }} \
--no-create-info \
{% if zabbix_server_backup_on_full_only %}
{% for table in ['events', 'history', 'history_uint', 'history_str', 'history_text', 'trends', 'trends_uint'] %}
--ignore-table={{ zabbix_server_db_name }}.{{ table }} \
--ignore-table={{ zabbix_server_db_name }}.{{ table }} \
{% endfor %}
--quick --single-transaction \
--add-locks \
{% endif %}
--quick --single-transaction \
--add-locks \
{{ zabbix_server_db_name | quote }} | zstd -T0 -c > /home/lbkp/zabbix/{{ zabbix_server_db_name }}_data.sql.zst
{% if zabbix_server_backup_on_full_only %}
fi

Loading…
Cancel
Save