nagios发送告警邮件到qq邮箱

ip 主机名 备注
172.16.121.236 nagios 服务端
172.16.121.237 client1 客户端

安装

[[email protected] ~]# yum install sendmail* mailx -y

编辑配置文件

[[email protected] ~]# vi /etc/mail.rc

set from=*********@qq.com		         qq
set smtp=smtp.qq.com
set smtp-auth-user=*********@qq.com		qq
set smtp-auth-password=*********		qq的stmp授权码
set smtp-auth=login

重启

[[email protected] ~]# systemctl restart sendmail

Mail测试

[[email protected] objects]# echo 'wjh'|mail -s 'wjh' *********@qq.com`

修改联系人
[[email protected] ~]# cd /usr/local/nagios/etc/objects/
[[email protected] objects]# vi contacts.cfg

define contact {

    contact_name            nagiosadmin             ; Short name of user
    use                     generic-contact         ; Inherit default values from generic-contact template (defined above)
    alias                   Nagios Admin            ; Full name of user
    email                   *********@qq.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}

检查配置文件,重启nagios

[[email protected] objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
[[email protected] objects]# systemctl restart nagios
测试邮件告警

[[email protected] ~]# systemctl stop nagios //停止主节点的nagios服务

发布了25 篇原创文章 · 获赞 0 · 访问量 672

猜你喜欢

转载自blog.csdn.net/miss_miss6/article/details/105140775

相关文章