| Category: | admin |
| Author/Contact Info | Kri |
| Description: | very simple perl script that use some shell commands b/c i was to lazy to parse it correctly in perl, but it alerts you what the status of your so say critical backups status or if they are getting trashed. you'll need list of the classes you want watch for. |
#!/usr/bin/perl -w use strict; open(TEST, "< /usr/local/bin/hosts") or die "This file doesnt exist or + cant be opened /usr/local/bin/hosts #!\n"; open(LOGFILE, "> /tmp/log_backup.txt") or die "Can't write to /tmp/lo +g_backup.txt: $!"; $old_fh=select(LOGFILE); chomp($cur_date=`date +\%m\"\/\"\%d\"\/\"\%Y`); chomp($reciept="email\@help.com"); print "-----------------$cur_date------------------------\n"; print "--------------Process ID $$----------------------\n\n\n"; system("/opt/openv/netbackup/bin/admincmd/bpdbjobs -report -format_fil +e /var/tmp/.xbpmonrc > /tmp/jobs"); while(<TEST>){ chop($_); print "-----------------$_---------------------\n"; chomp($_); $err=`cat /tmp/jobs | grep $_ | grep -i done | grep $cur_date +| awk \'\$4\!=0\' | wc -l`; print " $_ Number of errors: $err \n"; $act=`cat /tmp/jobs | grep $_ | grep -i active | grep $cur_date | +wc -l`; print " $_ Number of Active Jobs: $act \n"; $total=`cat /tmp/jobs | grep $_ | grep $cur_date | wc -l`; print " $_ Number of Jobs Done Today: $total \n"; print "\n"; } print "*************************************************************** +*****************\n"; print "Please ignore excessive errors on sapr0007 or sapr0008. Due to + these being in a\n"; print "clustered configuration, the inactive node will have multiple b +ackup errors\n "; print "*************************************************************** +*****************\n"; close(TEST); close(LOGFILE); select($old_fh); print "\nScript finished $cur_date\n\n"; system("/usr/ucb/mail -s \".::Backup Report::.\" $reciept < /tmp/log_b +ackup.txt"); system("/usr/ucb/mail -s \"----Logs----\" $reciept < /usr/emcbcv/rpr/l +ogs/backup_bcv_\`date +\%Y\%b\%d\`.log"); |
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: netbackup alert
by Kri (Acolyte) on Oct 14, 2002 at 18:56 UTC |