| Server IP : 198.38.94.67 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64 User : azfilmst ( 1070) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/lib64/nagios/plugins/ |
Upload File : |
#!/bin/bash
#
# mysql_backup_check.sh a bash script that checks if the backup of databases defined in $MONITORED_DB were successful
# it monitors mysql backups that are created by /opt/bin/mysql_backup.sh script
# REF: SYSENG-23785
# author: mfranczak@a2hosting.com
# Comma separated list of the backups of databases we want to monitor.
MONITORED_DB="omni,supersekrit,mysql,information_schema"
# Backup location
BACKUP_LOCATION="/opt/backup/"
FAILED_BCKP=''
# Set the Internal Field Separator (IFS) to a comma
IFS=','
# Convert the variable into an array
read -ra DBS <<< "$MONITORED_DB"
# Loop through the array of monitored DBs and echo each value separately
for DB in "${DBS[@]}"; do
ERROR=$(find "${BACKUP_LOCATION}" -type f -name ".backup_failed_${DB}" | wc -l)
# Alert if backup number is 0
if [ "${ERROR}" != "0" ]; then
if [ -z "${FAILED_BCKP}" ]; then
FAILED_BCKP="${DB}"
else
FAILED_BCKP="${FAILED_BCKP}, ${DB}"
fi
fi
done
if [ -z "${FAILED_BCKP}" ]; then
echo "check_a2_omni_mysql_backup.sh - mysql backups successful"
exit 0
else
echo "check_a2_omni_mysql_backup.sh - backup of the database ${FAILED_BCKP} failed"
exit 2
fi