# . check for logs that are never updating and warn
# . change constantly updating logs (maildir) to be more friendly
# . documentation
# . check for logs that are never updating and warn
# . change constantly updating logs (maildir) to be more friendly
# . documentation
#
# note: some backups never finish, such as the maildir one, need to handle these
# perhaps by looking for FAILED messages?
#
# note: some backups never finish, such as the maildir one, need to handle these
# perhaps by looking for FAILED messages?
# should be looked for
# note3: there are also these entries:
# Jan 20 14:00:01 Fatal: No backup actions configured in '/etc/backup.d', run ninjahelper!
# should be looked for
# note3: there are also these entries:
# Jan 20 14:00:01 Fatal: No backup actions configured in '/etc/backup.d', run ninjahelper!
- fatal=0
- warning=0
- error=0
-
- while read line
- do
- line_array=($line)
- fatal=$(($fatal + ${line_array[8]}))
- error=$(($error + ${line_array[10]}))
- warning=$(($warning + ${line_array[12]}))
- done
- if (( $fatal || $warning || $error )); then
- echo "`basename $host .log`: $fatal fatals found, $error errors found, $warning warnings found" >> $statusfile
- echo "" >> $reportappend
- echo "`basename $host .log` log entries since last ninjareport" >> $reportappend
- echo "---------" >> $reportappend
- cat $logupdates >> $reportappend
- rm $logupdates
- fi
+ fatal=0
+ warning=0
+ error=0
+
+ while read line
+ do
+ line_array=($line)
+ fatal=$(($fatal + ${line_array[8]}))
+ error=$(($error + ${line_array[10]}))
+ warning=$(($warning + ${line_array[12]}))
+ done
+ if (( $fatal || $warning || $error )); then
+ echo "`basename $host .log`: $fatal fatals found, $error errors found, $warning warnings found" >> $statusfile
+ echo "" >> $reportappend
+ echo "`basename $host .log` log entries since last ninjareport" >> $reportappend
+ echo "---------" >> $reportappend
+ cat $logupdates >> $reportappend
+ rm $logupdates
+ fi
# Generate a report, only if there are failures
if [ -s $statusfile ]; then
# Generate a report, only if there are failures
if [ -s $statusfile ]; then
- echo " backupninja mission failures - `date`" >> $reportfile
- echo " --------------------------------------------------------------" >> $reportfile
- echo "" >> $reportfile
- cat $statusfile | column -t >> $reportfile
- echo "" >> $reportfile
- echo " log entries from failed reports" >> $reportfile
- echo " -----------------------------------" >> $reportfile
- cat $reportappend >> $reportfile
+ echo " backupninja mission failures - `date`" >> $reportfile
+ echo " --------------------------------------------------------------" >> $reportfile
+ echo "" >> $reportfile
+ cat $statusfile | column -t >> $reportfile
+ echo "" >> $reportfile
+ echo " log entries from failed reports" >> $reportfile
+ echo " -----------------------------------" >> $reportfile
+ cat $reportappend >> $reportfile
This script generates a backupninja status report for all configured
systems. It requires that each status report is placed in a spot where
ninjareport can read it, reports are mailed to the reportemail
configured in @CFGDIR@/backupninja.conf.
The following options are available:
This script generates a backupninja status report for all configured
systems. It requires that each status report is placed in a spot where
ninjareport can read it, reports are mailed to the reportemail
configured in @CFGDIR@/backupninja.conf.
The following options are available:
--h, --help This usage message
--f, --conffile FILE Use FILE for the configuration instead
- of @CFGDIR@/backupninja.conf
--m, --mail <email> Mail the report to this address
--o, --out Don't mail the report, just display it
+-h, --help This usage message
+-f, --conffile FILE Use FILE for the configuration instead
+ of @CFGDIR@/backupninja.conf
+-m, --mail <email> Mail the report to this address
+-o, --out Don't mail the report, just display it
- case $1 in
- -h|--help)
- usage
- exit 0
- ;;
- -f|--conffile)
- if [ -f $2 ]; then
- conffile=$2
- else
- echo "-f|--conffile option must be followed by an existing filename"
- fatal "-f|--conffile option must be followed by an existing filename"
- usage
- fi
- # we shift here to avoid processing the file path
- shift
- ;;
- -m|--mail)
- reportemail=$2
- shift
- ;;
- -o|--out)
- mail=0
- display=1
- ;;
- *)
- echo "Unknown option $1"
- usage
- exit
- ;;
- esac
- shift
-done
+ case $1 in
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ -f|--conffile)
+ if [ -f $2 ]; then
+ conffile=$2
+ else
+ echo "-f|--conffile option must be followed by an existing filename"
+ fatal "-f|--conffile option must be followed by an existing filename"
+ usage
+ fi
+ # we shift here to avoid processing the file path
+ shift
+ ;;
+ -m|--mail)
+ reportemail=$2
+ shift
+ ;;
+ -o|--out)
+ mail=0
+ display=1
+ ;;
+ *)
+ echo "Unknown option $1"
+ usage
+ exit
+ ;;
+ esac
+ shift
+done