1.发邮件启动postfix
/etc/init.d/postfix start
mail -s "test" 836503270@qq.com < /etc/inittab
mailq
查看发送结果
2.配置发邮件文件
mkdir -p /home/zabbix/bin
vim /home/zabbix/bin/baojing.sh
#! /bin/bash echo "$3" |/bin/mail -s "$2" $1
chmod +x /home/zabbix/bin/baojing.sh
修改zabbix服务器配置文件
vim /etc/zabbix/zabbix_server.conf
AlertScriptsPath=/var/lib/zabbixsrv/alertscripts 改为 AlertScriptsPath=/home/zabbix/bin ExternalScripts=/var/lib/zabbixsrv/externalscripts 改为 ExternalScripts=/home/zabbix/bin
3.web
Administration - Media types - create media type
Type script
script name baojing.sh
save
4.创建用户
Administration - users - user - create user
alias test1
name denny
surname admin
passwd admin
paddwd admin
groups Zabbix administrators
media - add
type baojing
send to 836503270@qq.com
add
save
5.
Configuration - Actions - create action
name baojing
operations - new
Send to Users - add - test1 -select
Send to User groups - add - Zabbix administrators
Send only to - baojing
Operation details -add
save