1
0
Fork 0
forked from infra/ansible

Zabbix: Migrate MariaDB backup file-age check from Nagios

(also fix tags in the Sigul monitoring from earlier)

Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
This commit is contained in:
Greg Sutcliffe 2026-06-08 16:17:13 +01:00
commit ca291c8669
Signed by: gwmngilfen
SSH key fingerprint: SHA256:dNHcz65ApR68w2TkCIAXDBdt4oNL62Fyx48U7dXWuk0
5 changed files with 67 additions and 9 deletions

View file

@ -0,0 +1,41 @@
zabbix_export:
version: '7.0'
template_groups:
- uuid: a333cbd6a3ad44baaa4eee4b0c0b1bec
name: Fedora
templates:
- uuid: 0191241efdc1421996fdf3352d851dfa
template: 'MariaDB Backups'
name: 'MariaDB Backups'
description: 'single check for the mysql backup file'
groups:
- name: Fedora
items:
- uuid: dc68a51b1eb4497b938f9ebb4b07050b
name: 'Mysql backup timestamp'
type: ZABBIX_ACTIVE
key: 'vfs.file.time[/backups/fpo-mediawiki-latest.xz,modify]'
units: unixtime
tags:
- tag: application
value: mysql
triggers:
- uuid: 194ae33956aa49e39553003a40bbd967
expression: 'now() - last(/MariaDB Backups/vfs.file.time[/backups/fpo-mediawiki-latest.xz,modify]) > 86400'
name: 'Mysql backup is out of date'
opdata: 'Backup Timestamp: {ITEM.LASTVALUE1}'
priority: WARNING
dependencies:
- name: 'Mysql backup is out of date'
expression: 'now() - last(/MariaDB Backups/vfs.file.time[/backups/fpo-mediawiki-latest.xz,modify]) > 129600'
tags:
- tag: scope
value: backups
- uuid: 8fc5e8c82d27476e9d6429a158d5aecd
expression: 'now() - last(/MariaDB Backups/vfs.file.time[/backups/fpo-mediawiki-latest.xz,modify]) > 129600'
name: 'Mysql backup is out of date'
opdata: 'Backup Timestamp: {ITEM.LASTVALUE1}'
priority: HIGH
tags:
- tag: scope
value: backups

View file

@ -67,3 +67,27 @@
- name: Set domain_can_mmap_files so collectd and nagios work
seboolean: name=domain_can_mmap_files state=yes persistent=yes
- name: Zabbix API Block
vars:
ansible_zabbix_auth_key: "{{ zabbix_auth_key }}"
ansible_network_os: "{{ zabbix_network_os }}"
ansible_connection: "{{ zabbix_connection }}"
ansible_httpapi_port: "{{ zabbix_httpapi_port }}"
ansible_httpapi_use_ssl: "{{ zabbix_httpapi_use_ssl }}"
ansible_httpapi_validate_certs: "{{ zabbix_httpapi_validate_certs }}"
ansible_host: "{{ zabbix_server }}"
ansible_zabbix_url_path: "{{ zabbix_url_path }}"
tags:
- zabbix_api
- mariadb-server
block:
- name: Import MariaDB template file
community.zabbix.zabbix_template:
template_yaml: "{{ lookup('file', 'zabbix-template.yml') }}"
state: present
- name: Add self to MariaDB in Zabbix
community.zabbix.zabbix_host:
host_name: "{{ inventory_hostname }}"
link_templates: MariaDB Backups
force: false

View file

@ -1,6 +0,0 @@
define service {
host_name db03.rdu3.fedoraproject.org
service_description Check MySQL Backup
check_command check_by_nrpe!check_mysql_backup
use defaulttemplate
}

View file

@ -182,7 +182,6 @@
- name: Copy /etc/nagios/services (RDU3 specific files)
ansible.builtin.copy: src=nagios/services/rdu3_internal/{{ item }} dest=/etc/nagios/services/{{ item }}
with_items:
- db_backups.cfg
- disk.cfg
- fedora_messaging.cfg
- file_age.cfg
@ -199,7 +198,6 @@
- name: Copy /etc/nagios/services (RDU3 specific files)
ansible.builtin.copy: src=nagios/services/rdu3_internal/{{ item }} dest=/etc/nagios/services/{{ item }}
with_items:
- db_backups.cfg
- disk.cfg
- fedora_messaging.cfg
- file_age.cfg

View file

@ -33,7 +33,8 @@
ansible_zabbix_url_path: "{{ zabbix_url_path }}"
tags:
- zabbix_api
- anubis
- sigul
- sigul/bridge
block:
- name: Import Sigul template file
community.zabbix.zabbix_template: