Created
July 16, 2017 15:53
-
-
Save northox/59ec4c488e1bc116584dffaf958feaa7 to your computer and use it in GitHub Desktop.
Compares the number of bacula's clients within the director config with todays successful backups. It assumes client's name are right after the 'Client {' opening brackets.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ksh | |
DIRPATH='/etc/bacula/bacula-dir.conf' | |
NOERROR='Backup missing for: ' | |
ERROR=$NOERROR | |
TODAY=`date "+%v" | sed 's/-20/-/'` | |
OKSTATUS=`echo 'status storage=FileStorage' | bconsole | grep ${TODAY} | grep OK` | |
CLIENTS=`grep '^Client {' -A1 $DIRPATH | grep Name | sed -E 's/ +Name = ([a-zA-Z]+)-fd/\1/'` | |
for c in $CLIENTS; do | |
echo -n "$OKSTATUS" | grep -q $c | |
if [ $? -ne 0 ]; then | |
ERROR="${ERROR}$c " | |
fi | |
done | |
if [ "$ERROR" != "$NOERROR" ]; then | |
echo $ERROR | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment