Search
j0ke.net Open Build Service
>
Projects
>
internetx
>
nagios-plugins-automysqlbackup
> check_multimysqlbackup
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File check_multimysqlbackup of Package nagios-plugins-automysqlbackup
#!/bin/bash CONFPATH="/etc/multimysqlbackup.conf" STAT=0 if [ -s "${CONFPATH}" ] ; then # read each active host from multimysql backup config for LINE in `cat ${CONFPATH} | grep -v ^# | grep -v ^$ | sed -e s@" "@"%20%"@g` ; do # get the hostname export DBHOST=`echo ${LINE} | awk -F\; '{print $1}' | awk -F: '{print $1}'` unset BACKUPDIR # include default configuration to construct dynamic backup path (BACKUPDIR) [ -f /etc/automysqlbackup/automysqlbackup.conf ] && . /etc/automysqlbackup/automysqlbackup.conf count=$( find ${BACKUPDIR}/. -type f -name '*.bz2' -o -name '*.gz' -o -name '*.sql' -mtime 0 | wc -l ) if [ $count -gt 0 ] ; then echo "OK: found $count table backup files for host - $DBHOST" STAT=$(expr $STAT + 0) else echo "ERROR: Latest MySQL backup for $DBHOST is older than 24 hours, please check!" STAT=$(expr $STAT + 2) fi done | sort fi if [ ${STAT} > 2 ] ; then exit 2 else exit 0 fi