#启动邮箱服务
systemctl start postfix.service
#配置用户的邮箱发送邮件
vim /etc/mail.rc
set from="xxx@xxx.com"
set smtp="smtps://smtp.exmail.qq.com:465"
set smtp-auth-user="xxx@xxx.com"
set smtp-auth-password="xxxxxx"
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb
#测试发送邮件
[root@VM_centos ~]# echo "messages" | mail -v -s "subject" yxxx@qq.com
Resolving host smtp.exmail.qq.com . . . done.
Connecting to 163.177.90.125:465 . . . connected.
Error in certificate: Peer's certificate issuer is not recognized.
Comparing DNS name: "pop.qq.com"
Comparing DNS name: "ex.qq.com"
Comparing DNS name: "imap.exmail.qq.com"
Comparing DNS name: "rtx.exmail.qq.com"
Comparing DNS name: "smtp.exmail.qq.com"
SSL parameters: cipher=AES-128, keysize=128, secretkeysize=128,
issuer=CN=GeoTrust RSA CA 2018,OU=www.digicert.com,O=DigiCert Inc,C=US
subject=CN=pop.qq.com,OU=R&D,O=Shenzhen Tencent Computer Systems Company Limited,L=Shenzhen,ST=Gu
220 smtp.qq.com Esmtp QQ Mail Server
...
>>> QUIT
221 Bye
#解决证书解析报错
#手动的获取QQ 邮箱的证书保存到本地指定的目录里以备调用和验证
[root@VM_centos ~]# cd /etc/pki/nssdb/
[root@VM_centos nssdb]# ls
cert8.db cert9.db key3.db key4.db pkcs11.txt secmod.db
[root@VM_centos nssdb]# echo -n | openssl s_client -connect smtp.exmail.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' >qq.crt
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = GeoTrust RSA CA 2018
verify return:1
depth=0 C = CN, ST = Guangdong, L = Shenzhen, O = Shenzhen Tencent Computer Systems Company Limited, OU = R&D, CN = pop.qq.com
verify return:1
DONE
[root@VM_centos nssdb]# certutil -A -n "GeoTrust SSL CA" -t "C,," -d /etc/pki/nssdb -i qq.crt
[root@VM_centos nssdb]# certutil -A -n "GeoTrust Global CA" -t "C,," -d /etc/pki/nssdb -i qq.crt
[root@VM_centos nssdb]# certutil -L -d /etc/pki/nssdb
#进入邮箱 SSL 证书存放目录,为了信任证书的标记操作
[root@VM_centos nssdb]# certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt
Notice: Trust flag u is set automatically if the private key is present.
#解决发送是附件
#只要把行尾^M去掉,然后发送的话就不会是附件的形式了
[root@VM_centos nssdb]# yum -y install dos2unix.x86_64
[root@VM_centos nssdb]# vim /usr/lib/zabbix/alertscripts/sendmail.sh
#!/bin/bash
TMP_FILE=/usr/lib/zabbix/alertscripts/tmp_messages.txt
echo $3 | tr '\r\n' '\n' > ${TMP_FILE} #把^M替换为\n
# dos2unix ${TMP_FILE} #解决发送的邮件内容变成附件的问题 未解决
subject=$2
mail -s "${subject}" $1 >>/var/log/sendmail.log 2>&1 <${TMP_FILE}
#注意权限是chown zabbix.zabbix
#zabbix 管理---->报警媒介类型
#查看zabbix脚本位置
[root@VM_centos alertscripts]# grep alertscripts /etc/zabbix/zabbix_server.conf
AlertScriptsPath=/usr/lib/zabbix/alertscripts


- zabbix4.2配置邮件+脚本报警:以QQ邮箱为例
一.邮箱配置:开启smtp服务和授权 开启smtp选项后,系统会生成一个授权,你需要记住这个授权码,后面需要写入配置文件. 二.配置管理mailx: (1)安装mailx:[root@zabbix-s ...
- zabbix配置报警媒介-用户-动作-邮件脚本触发mailx邮件报警
2018-09-16更新,新版本zabbix不需要使用脚本发送邮件,在zabbix web界面直接配置就可以 配置邮件参数,测试发送邮件 确认安装相关服务,centos7默认安装 [root@VM_1 ...
- 通过脚本发送zabbix邮件报警
zabbix原生的报警媒介类型中,邮件报警是我们常用的方式.当我们在CentOS6上面安装zabbix3.0并配置邮件报警的时候,在邮件配置正确的前提下,不管触发器如何触发,邮件总是发送不出去,但是在 ...
- centos7之zabbix邮件报警(短信报警)
前言 前面我们介绍了zabbix的基本linux和window及SNMP流量的简单监控,我们知道作为运维人员,需要7x24小时待命,但是我们不可能时时刻刻都坐在电脑旁边查看监控上的各个主机状态,所以我 ...
- Zabbix邮件报警配置
一.安装sendmail或者postfix yum install sendmail #安装 service sendmail start #启动 chkconfig sendmail on #设置开 ...
- zabbix 邮件报警
一.设置sendmail 安装sendmail yum install -y sendmail systemctl start sendmail.service 配置 cd /usr/lib/zab ...
- Zabbix 邮件报警示例
Zabbix 邮件报警示例: 1.编辑 mail.rc 文件添加默认的邮箱配置 # vi /etc/mail.rc set from=1234567@qq.com set smtp=smtp.qq. ...
- zabbix*邮件报警 *用户参数User parameters *定义key值 *Agentd主动模式与被动模式
邮件报警 #下载安装邮件报警系统wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz yum - ...
- zabbix 邮件报警(五)
一.sendEmail配置zabbix邮件报警 1.下载sendEmail: wget http://caspian.dotconf.net/menu/Software/SendEmail/sendE ...
随机推荐
- 图解SOAPUI解析WSDL文件
本文链接:https://blog.csdn.net/qq_16234613/article/details/53143279 新建项目 添加WSDL文件 查看方法 查看XML格式 运行测试
- js splice()
//arrayObject.splice(index,howmany,item1,.....,itemX) 语法 //测试代码let array;array = ['George','John','T ...
- 1.Java多线程之wait和notify
1.首先我们来从概念上理解一下这两个方法: (1)obj.wait(),当obj对象调用wait方法时,这个方法会让当前执行了这条语句的线程处于等待状态(或者说阻塞状态),并释放调用wait方法的对象 ...
- python UI自动化生成BeautifulReport测试报告并保存截图
前面已经写过利用BeautifulReport生成测试报告,那么接下来讲讲如何在测试报告里面保存截图 首先需要在测试用例中定义一个截图的方法: # 截图方法 """ os ...
- 用python脚本测试接口
自己写一个脚本,统计调用200次接口的请求时长. # -*- coding=utf-8 -*-import osimport requestsimport time url = "http: ...
- 517,sytlus/sass/less的区别
均具有“变量”,“混合”,“嵌套”,“继承”,“颜色混合”五大基本特性 scss和less语法较为严禁,less要求一定要使用大括号“{}”,scss和stylus可以通过缩进表示层次与嵌套关系 sc ...
- Chrome浏览器支持跨域访问
创建一个chrome的快捷方式,并加上参数 --allow-file-access-from-files --disable-web-security --user-data-dir="D: ...
- Makefile export
1) 1.在(parent,上层的)makefile中export出来变量,子makefile(sub make)中,是可以访问的. 2. 而同一级别的makefile(可通过makefile中内置变 ...
- Java8 Time API与老Date之间的转换
前面我已经总结了Java8 Time API常用的一些方法.封装的工具类,可是最近需要对一个比较老的项目进行重构,大致看了一下使用的Jdk还是7而且里面的时间工具类还是使用的Date和Calendar ...
- Lenet 神经网络-实现篇(1)
Lenet 神经网络结构为: ①输入为 32*32*1 的图片大小,为单通道的输入: ②进行卷积,卷积核大小为 5*5*1,个数为 6,步长为 1,非全零填充模式: ③将卷积结果通过非线性激活函数: ...