1、检查commands.cfg
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****nnNotification
Type: $NOTIFICATIONTYPE$nHost: $HOSTNAME$nState: $HOSTSTATE$nAddress: $HOSTA
DDRESS$nInfo: $HOSTOUTPUT$nnDate/Time: $LONGDATETIME$n" | /bin/mail -s "** $
NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****nnNotification
Type: $NOTIFICATIONTYPE$nnService: $SERVICEDESC$nHost: $HOSTALIAS$nAddress:
$HOSTADDRESS$nState: $SERVICESTATE$nnDate/Time: $LONGDATETIME$nnAdditional
Info:nn$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert:
$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
这是正确的命令配置,其中最重要的就是/bin/
2、mqueue
[root@localhost mqueue]# pwd
/var/spool/mqueue
[root@localhost mqueue]# ll
total 8
-rw------- 1 root smmsp 8 Nov 18 20:54 dfmAICsFQj009878
-rw------- 1 root smmsp 901 Nov 18 21:56 qfmAICsFQj009878
[root@localhost mqueue]#
这个目录存储的是邮件发送队列,
3、修改access
[root@localhost mail]# pwd
/etc/mail
[root@localhost mail]# vi access
# Check the /usr/share/doc/sendmail/
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/
# package.
#
# by default we allow relaying from localhost...
Connect:localhost.localdomain
Connect:localhost
Connect:127.0.0.1
Connect:192.168.0
Connect:http://www.163.com
Connect:1.1.1
Connect:nagios@localhost.
Connect:root@localhost
或者是makemap -v hash /etc/mail/access.db < /etc/mail/access
4、[root@localhost spool]# pwd
/var/spool
chmod 777 mqueue
我的邮箱是163.com。
5、. 检查所传送的电子邮件是否送出,或滞留在邮件服务器中
语法:/usr/lib/sendmail -bp
若屏幕显示为“Mail queue is empty” 的信息,表示mail 已送出。
6检查邮件发送过程
在Sendmail邮件服务器上执行下面的命令.
# echo testing | /usr/sbin/sendmail -v someone@somedomain.com
7、sendmail日志
[root@localhost log]# pwd
/var/log
vi maillog就可以看了,出现任何错误都可以看到。