配置环境:
CentOS-7 bacula-9.0.6
官方参考文档:
http://www.bacula.org/9.0.x-manuals/en/main/Messages_Resource.html
邮件参数:
%b = Job Bytes
%c = Client's name
%d = Daemon's name (Such as host-dir or host-fd)
%D = Director's name (Also valid on file daemon)
%e = Job Exit Status
%f = Job FileSet (Only on director side)
%F = Job Files
%h = Client address
%i = JobId
%j = Unique Job id
%l = Job Level
%n = Job name
%p = Pool name (Only on director side)
%P = Current PID process
%r = Recipients
%s = Since time
%t = Job type (Backup, ...)
%v = Volume name (Only on director side)
%w = Storage name (Only on director side)
%x = Spooling enabled? ("yes" or "no")
案例:
官方要求安装sendmail才能正常对外发送日志邮件,我们其实只需要在原有配置上做修改,改为mail发送并添加官方的参数即可
mailcommand = "mail -s "Bacula: %t %e of %c %l JobId: %i" 123@mail.com"
日志邮件标题样式:
Bacula: Backup OK of bacula2-fd Full JobId: 41
如果只需要job出错才发告警邮件 可把mail = 修改为MailOnError =
例如:
mail = root@localhost = all, !skipped
修改为
MailOnError = root@localhost = all, !skipped