十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
1、安装相关组建
成都创新互联专业为企业提供新源网站建设、新源做网站、新源网站设计、新源网站制作等企业网站建设、网页设计与制作、新源企业网站模板建站服务,10余年新源做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
yum install mailx sendmail*
chkconfig sendmail on
service sendmail start
2、测试邮件
echo "Hello World" | mail abc@abc.com
3、设置发件人
[root@localhost]#vi /etc/mail.rc
set from=skykws@163.com smtp=smtp.163.com set smtp-auth-user=skykws smtp-auth-password=000000 smtp-auth=login
4、编辑command.cfg
# 'notify-host-by-email' command definition
define command{
command_namenotify-host-by-email
command_line/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_namenotify-service-by-email
command_line/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
4、重启nagios
service nagios restart
5、后记
关于报警发送间隔等等设置不做详细介绍