zabbix_export: version: '5.4' date: '2021-11-21T21:36:50Z' groups: - uuid: 6f6799aa69e844b4b3918f779f2abf08 name: 'Zabbix servers' templates: - uuid: 460c29ca4f694f498cf32c24caf6d140 template: 'Zabbix DB Partitions' name: 'Zabbix DB Partitions' description: | ## Overview This template create items to monitor 5 days worth of partitions have been created for your database. This template is intended to be used for the Zabbix Database partitions, however could be modified to check for any database partitions. Install Steps: * Import template into Zabbix 3.2 or > * Set the {$PASSWORD} Macro to the password for the account which will be preforming the check * Update EACH item to have the user that will be preforming the check, Default==Root * Update the ls path used in each item for the correct path to your DB * Apply to each of your DB hosts in Zabbix ![Software Information Systems](https://www.thinksis.com/images/header/logo.jpg) ## Author SIS groups: - name: 'Zabbix servers' items: - uuid: 36c13ec7e1294b739df763bbf2d0b22f name: 'Current Daily Partition count' type: SSH key: 'ssh.run[dpc,{HOST.HOST},22,]' delay: 30s params: 'ls /var/lib/mysql/zabbixdb | grep -c $(date +%F | sed s/-//g)' username: root password: '{$PASSWORD}' description: 'Gets the current count of the number of daily partitions in the /var/lib/mysql/zabbixdb, this will need to be adjusted to fit your environment.' tags: - tag: Application value: 'DB Partitions' - uuid: 10865cd3462b4fbbb71c67f193516dc2 name: 'Tomorrow Daily Partition Count' type: SSH key: 'ssh.run[dpc1,{HOST.HOST},22,]' delay: 30s params: 'ls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+1days "+%Y%m%d")' username: root password: '{$PASSWORD}' description: | ls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+Xdays "+%Y%m%d") Workflow 1. List the content of the /var/lib/mysql/zabbixdb folder 2. Print the grep count of current date, + X days ahead, printing the format like the partition file name. tags: - tag: Application value: 'DB Partitions' - uuid: fed62e7c1e1f4bc597658d0e367df69b name: 'Third Daily Partition Count' type: SSH key: 'ssh.run[dpc3,{HOST.HOST},22,]' delay: 30s params: 'ls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+2days "+%Y%m%d")' username: root password: '{$PASSWORD}' description: | ls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+Xdays "+%Y%m%d") Workflow 1. List the content of the /var/lib/mysql/zabbixdb folder 2. Print the grep count of current date, + X days ahead, printing the format like the partition file name. tags: - tag: Application value: 'DB Partitions' - uuid: cef23631772a43abbf573d9ad064b319 name: 'Fourth Daily Partition Count' type: SSH key: 'ssh.run[dpc4,{HOST.HOST},22,]' delay: 30s params: 'ls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+3days "+%Y%m%d")' username: root password: '{$PASSWORD}' description: | ls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+Xdays "+%Y%m%d") Workflow 1. List the content of the /var/lib/mysql/zabbixdb folder 2. Print the grep count of current date, + X days ahead, printing the format like the partition file name. tags: - tag: Application value: 'DB Partitions' - uuid: 348bbef8873f4444ae5e89ce9df3ad24 name: 'Fifth Daily Partition Count' type: SSH key: 'ssh.run[dpc5,{HOST.HOST},22,]' delay: 30s params: 'ls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+4days "+%Y%m%d")' username: root password: '{$PASSWORD}' description: | ls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+Xdays "+%Y%m%d") Workflow 1. List the content of the /var/lib/mysql/zabbixdb folder 2. Print the grep count of current date, + X days ahead, printing the format like the partition file name. tags: - tag: Application value: 'DB Partitions' macros: - macro: '{$PASSWORD}' triggers: - uuid: c01892911a1a4de5b81d0a6f6bb1aca5 expression: | last(/Zabbix DB Partitions/ssh.run[dpc1,{HOST.HOST},22,],#2)<>7 or last(/Zabbix DB Partitions/ssh.run[dpc3,{HOST.HOST},22,],#2)<>7 or last(/Zabbix DB Partitions/ssh.run[dpc4,{HOST.HOST},22,],#2)<>7 or last(/Zabbix DB Partitions/ssh.run[dpc5,{HOST.HOST},22,],#2)<>7 name: 'Future Partition missing' priority: DISASTER