1754955 Members
3065 Online
108827 Solutions
New Discussion юеВ

monitoring backups

 
muluesk
New Member

monitoring backups

Is there any way to setup a cron job or something so that I get an email notification when a backup fails, linux 7.1 server.
8 REPLIES 8
Mark Grant
Honored Contributor

Re: monitoring backups

This would depend on how you are backing up. What software are you using?

Generally speaking, the backup software itself is better at determining if the backup was successful or not and is therefore often the best thing to do the alerting if something has gone wrong.
Never preceed any demonstration with anything more predictive than "watch this"
muluesk
New Member

Re: monitoring backups

There is a jobstack that is setup to kick off at a specified time. you are right the software knows when the Full save is good or not and outputs error messages. I can find out about that by tailing the log file it generates. But the thing is I administer more than a 100 servers and I have to log in to each server from time to time and find out if the save is running or not. If it fails, I have to ran a manual save. What I'm trying to do is get a notification whenever the file save fails so that I can ran the manual save.
To answer your question, there is no as such a back up SW installed on the server, and there is no GUI, all is done from a command line. And the backup does a system and data save.
Mark Grant
Honored Contributor

Re: monitoring backups

In that case you could set up a cron job that runs a script. Suppose you want to check every day at 10.00am you cron job will look like this.

00 10 * * * myscript

You script will do something like this

#!/usr/bin/sh

grep "ERROR" backuplog > /dev/null && echo "backup failed on `hostname`|mailx -s "Backup error" e-mail
cat backuplog >> historylog && > backuplog

This will re-name your log file to another log file and everyday, your normal log file wil only contains the last 24 hours of log messages.

Obviously, change the word "ERROR" to something that will appear in the log file when you have a backup error.
Never preceed any demonstration with anything more predictive than "watch this"
Mark Grant
Honored Contributor

Re: monitoring backups

I just noticed a typo in that script. Missed out a "

grep "ERROR" backuplog > /dev/null && echo "backup failed on `hostname`"|mailx -s "Backup error" e-mail

is how that line should be.
Never preceed any demonstration with anything more predictive than "watch this"
Huc_1
Honored Contributor

Re: monitoring backups

Nice, and simple that one Mark, Just what I needed !...

Just though i would let you know someone read it and appreciated it!

Jean-Pierre
Smile I will feel the difference
Mark Grant
Honored Contributor

Re: monitoring backups

Nice to see you back Huc!

Been on holiday?
Never preceed any demonstration with anything more predictive than "watch this"
Huc_1
Honored Contributor

Re: monitoring backups

Vacation no ... new job on new platforms Sun Solaris, with lots to do and learn, nice to be back on a more known ground ... still been having fun, see you have all been busy in this forum i am trying to catch-up on week-end.

Muluesk please, forgive us for the highjack on your topic/question

Jean-Pierre
Smile I will feel the difference
muluesk
New Member

Re: monitoring backups

Thank you Mark. I didn't check my email this weekend that is why I didn't reply to you. I will try to setup the cron job like you suggested and will let you know the outcome. If it works you don't have any idea how much time and energy you will be saving me. Thanks for your help again.