1.在邮箱中获取授权码

2.zabbix配置
agengt配置
添加以下配置
[root@server03 ~]# visudo
zabbix ALL=(ALL) NOPASSWD: ALL
[root@server03 ~]# vim /etc/zabbix/zabbix_agentd.conf
EnableRemoteCommands=1 #允许接收远程命令 修改原有的值,不要在末尾追加
LogRemoteCommands=1 #把接收的远程命令记入日志
[root@server03 ~]# systemctl restart zabbix-agent.service #重启

zabbix添加邮件报警功能: 注:使用新的方式--利用公网邮件服务器发送报警,需要关闭postfix服务
配置 zabbix 的邮件报警功能需要以下三个角色的参与。 1、 示警媒体(Media) 2、 触发器(Triggers) 3、 动作(Action)
1.配置媒体类型


2.在用户中添加报警媒介

3.创建配置监控项

做一下配置并添加


4.创建触发器


5.创建动作


然后继续配置操作:将信息发送给用户Admin,因为在用户的报警媒介中已经配置了收件人。


继续配置恢复操作,当上边的远程命令执行后,恢复操作还会发一个邮件.


6.测试
在agent端手动关闭ssh服务 [root@server03 ~]# systemctl stop sshd
可以发现邮件想收到两封邮件,一封是故障告警,另一份是恢复后所发的。
