Below is the file 'client/plugins/backup.py' from this revision. You can also download the file.
from phonehome import urgency import os import glob import stat import datetime from config import install_path afbackup_log_dir = '/usr/local/backup/client/var/' def run(): results = [] if os.access(os.path.join(install_path, 'etc', 'no_backup_ok'), os.R_OK): return [(urgency['info'], 'skipped backup check, no_backup_ok found.')] if not os.access(afbackup_log_dir, os.R_OK): results.append ((urgency['warning'], "afbackup is not installed")) return results # find all the backup_log files; figure out the latest one most_recent_log = max (map (lambda fname: os.stat(fname)[stat.ST_MTIME], glob.glob(os.path.join(afbackup_log_dir, 'backup_log*')))) mtime = datetime.datetime.fromtimestamp(most_recent_log) now = datetime.datetime.now() if now - mtime > datetime.timedelta(weeks=1, days=1): results.append ((urgency['critical'], "backups are not running: most recent dump at %s" % str(mtime))) return results