最近在外网新搭了一套nagios系统,开始几天系统出了问题nagios还能发邮件通知,可最近出了问题老收不到邮件,手工在服务器上发邮件又可以,后来一查sendmail的日志和nagios的日志,发现sendmail的邮件只有邮件信息,没有进邮件队列.nagios那边的日志又报下面的警告:
[1292174436] Warning: Contact 'wahaha' service notification command '/usr/bin/printf "%b" "***** Nagios *****/n/nNotification Type: PROBLEM/n/nService: /boot/nHost: hostname/nAddress: 192.168.3.11/nState: CRITICAL/n/nDate/Time: Mon Dec 13 01:20:05 CST 2010/n/nAdditional Info:/n/nDISK CRITICAL - free space: /boot
8 MB (8% inode=99%):" | /bin/mail -s "** PROBLEM Service Alert: hostname//boot is CRITICAL **" wahaha@163.com' timed out after 30 seconds
从上面的日志看,应该是发送超时了,也就是说设置的通知时间还不够能让sendmail发出邮件的时间,到这就好办了.通过修改nagios的配置文件nagios.cfg,将notification_timeout=30改为notification_timeout=120后重起nagios.发现已经能收到报警邮件了,到此问题解决!