您好,登录后才能下订单哦!
Centos默认是安装sendmail的,我们可以用sendmail发送邮件。
mail -s "test" shan1987shan@126.com < sendmail.cf //测试邮件发送 Vi /usr/local/nagios/etc/object/contacts.cfg //添加邮箱
Vi /usr/local/nagios/etc/object/commad.cfg //增加邮箱命令
define command{
command_name notify-host-by-sendEmail
command_line /usr/bin/printf "%b" "***** Nagios-BJ *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "host $HOSTSTATE$ alter for $HOSTNAME$!" $CONTACTEMAIL$ -l /var/log/sendEmail.log
}
define command{
command_name notify-service-by-sendEmail
command_line /usr/bin/printf "%b" "***** Nagios-BJ *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ -l /var/log/sendEmail.log
}
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg //
Service nagios restart
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。