Register 163 mailboxes (can be registered by phone or registered as a string, enabling the Pop/stmp feature)
Linux system settings
#设置以外部邮箱发送邮件
Vim/etc/mail.rc
Set [email protected] #邮箱接受地址
Set smtp=smtp.163.com #smtp服务器地址, which is the mail sending server
Set smtp-auth-user=cknima228 #邮箱用户
Set smtp-auth-password=cknima228 #用户密码
Set Smtp-auth=login #认证类型 = Log In
echo "aiqyqy" |mail-s "tes the SMTP mail" [email protected]
#发送邮件测试
#163邮箱查看是否接受到邮件
Script Custom Channel
Alertscriptspath=/usr/lib/zabbix/alertscripts #zabbix调用脚本默认存放地点
VIM/ETC/ZABBIX/ZABBIX_SERVER.CONF/MAIL.SH #
#!/bin/bash
#DATE: 2016-08-02
#Author: Liwzpy
#Version: 1.00
#Mail: [Email protected]
echo "$ $" | Mail-s "$ $" $ #邮件正文, subject to $ $, accepted by $
Zabbix Web Settings
Set Media
Role: Use an external mailbox with a script-customized channel
Administration-media Types-greate MediaType (Create media type, upper right corner)
Name (163mail) #媒介名称
Type (script) type #媒介类型, drop-down selection
Script name (mail.sh) #填写脚本名称, default calls to scripts under/usr/lib/zabbix/alertscripts
Save #点击保存
Set up users
#作用: You can set any user by invoking a custom media
Administration-users-create user group (top right corner dropdown to users)
Admin #设置管理员
-media
Type (163.mail \) #下拉选择自定义的媒介
Send to ([email protected]) #填写邮件接受邮箱
When active (1-7,00:00-24:00) #设置邮件接收时间
Defining actions
Configuration-actions-create action (make sure the upper-right corner is trigger)
-action (Action information):
Name (Mysqldown) #填写动作名称
-conditions (conditions):
New Condition (trigger\/) (=\/) (MYSQ is down) Select #选择类型为触发器 trigger function selects the appropriate trigger for equivalence
Add #添加设置的规则
((B)Trigger value = problem The action is assumed as long as the trigger is triggered)
-operations (Operation)
New #添加新操作
Set from (1) #动作执行1-3 times, or three times, if setting to 1-0 means infinity
to (3)
Set Dutation #每次动作间隔60秒, if not set by default of 3600, that is, 60 minutes
Operation type (send massage\/) #操作类型为发送邮件
Send to User groups () #设置邮件接受组 (if only the set group represents the whole group to receive)
Send to Users () #设置邮件接受用户
Send only to (163mail \) #选择定义的媒介
Add #添加设置的规则
Save #保存全部规则
Verify:
Log in to 163 email to see if any messages are accepted
TimeHostDescriptionStatusSeverityDurationAck Actions
00:57:21httpdMySQL is downproblemWarning2m No
Ok #通过动作状态可判断邮件是否发送成功
This article is from the "Simple Linux" blog, so be sure to keep this source http://10157079.blog.51cto.com/10147079/1834557
zabbix-Mail Alarm