5.02021-11-21T21:36:48ZZabbix serversZabbix DB PartitionsZabbix DB Partitions## 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
Zabbix serversDB Partitions- Current Daily Partition countSSHssh.run[dpc,{HOST.HOST},22,]30sls /var/lib/mysql/zabbixdb | grep -c $(date +%F | sed s/-//g)root{$PASSWORD}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.DB Partitions
- Tomorrow Daily Partition CountSSHssh.run[dpc1,{HOST.HOST},22,]30sls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+1days "+%Y%m%d")root{$PASSWORD}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.DB Partitions
- Third Daily Partition CountSSHssh.run[dpc3,{HOST.HOST},22,]30sls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+2days "+%Y%m%d")root{$PASSWORD}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.DB Partitions
- Fourth Daily Partition CountSSHssh.run[dpc4,{HOST.HOST},22,]30sls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+3days "+%Y%m%d")root{$PASSWORD}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.DB Partitions
- Fifth Daily Partition CountSSHssh.run[dpc5,{HOST.HOST},22,]30sls /var/lib/mysql/zabbixdb | grep -c $(date -d "$(date +%F)"+4days "+%Y%m%d")root{$PASSWORD}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.DB Partitions
{$PASSWORD}{Zabbix DB Partitions:ssh.run[dpc1,{HOST.HOST},22,].prev()}<>7 or {Zabbix DB Partitions:ssh.run[dpc3,{HOST.HOST},22,].prev()}<>7 or
{Zabbix DB Partitions:ssh.run[dpc4,{HOST.HOST},22,].prev()}<>7 or
{Zabbix DB Partitions:ssh.run[dpc5,{HOST.HOST},22,].prev()}<>7Future Partition missingDISASTER