FreeBSD & MacOSX附带周期性(8)工具,它是一个整齐有序的工具集,用于定期运行系统function,如ZFS文件系统检查,安全检查,检查过时的端口等。
问题是周期性地发送太多包含太多多余信息的电子邮件。 这会导致人们忽略这些电子邮件,而且我们错过了周期性地提取的很多问题(8)。 每日电子邮件每天发送一次,安全电子邮件每天发送一次,每周和每月电子邮件也定期发送。 这些电子邮件有一个像这样的主题行:
Subject: $HOSTNAME daily run output Subject: $HOSTNAME security run output Subject: $HOSTNAME weekly run output Subject: $HOSTNAME monthly run output
如何减less定期(8)发送的电子邮件数量?
我会在下面发表我自己的回答,但我想看看别人做了什么。
注 :我有一个类似的Linux问题,在Linux上:logwatch(8)&cron.daily太吵了。 我怎样才能控制噪音水平?
在/etc/periodic.conf中放置如下内容。
以下configuration将减less电子邮件中的噪音。 如果这些消息是空白的,那么定期(8)将不会发送电子邮件。 此外,安全电子邮件将包含在每日电子邮件中,这也降低了噪音。
# /etc/periodic.conf overrides the defaults in /etc/defaults/periodic.conf # This file can be overriden by /etc/periodic.conf.local # *_show_success, *_show_info & *_show_badconfig are disabled # per recomendation of periodic(8) and "Absolute FreeBSD" p. 310-311 # and "Essential system administration, 3rd Ed." p. 98 # *_show_badconfig="NO" will suppress messages for tools which are not installed on this system (eg ZFS on a system without ZFS). daily_show_success="NO" daily_show_info="NO" daily_show_badconfig="NO" weekly_show_success="NO" weekly_show_info="NO" weekly_show_badconfig="NO" monthly_show_success="NO" monthly_show_info="NO" monthly_show_badconfig="NO" # Include security jobs with daily email. No need to send second email. daily_status_security_inline="YES" security_show_success="NO" # Don't need to know about denied packets every day daily_status_security_ipfdenied_enable="NO" ### Now, enable services which you DO want to be aware of # Check host for old ports daily_status_security_portaudit_enable="YES" # Perform ZFS filesystem checks daily_status_zfs_enable="YES"
上面的例子会让你有90%。 但是,还有一个额外的问题,使用标准的FreeBSDconfiguration无法解决(截至20110601)。 /etc/periodic/daily/450.status-security的脚本仍然会打印下列无意义的消息:
Security check: -- End of daily output --
修复方法是应用http://www.freebsd.org/cgi/query-pr.cgi?pr=138692中的修补程序。 此修补程序将修改450.status-security的返回代码,以便不会打印额外的消息。