vim /usr/local/zabbix/etc/zabbix_server.conf

# 添加如下行

AlertScriptsPath=/usr/local/zabbix/alertscripts


# 创建这个目录 定义一个脚本

# 定义脚本前必须先安装sendEmail这个软件

cat mail.sh

#!/bin/bash

 

to=$1

subject=$2

body=$3

 

# 这里是直接转码

subject_gb2312=`iconv -t GB2312 -f UTF-8 << EOF

$subject

EOF`

message_gb2312=`iconv -t GB2312 -f UTF-8 << EOF

$body

EOF`


/usr/local/bin/sendEmail -f 要发送的邮件名称比如123.qq.com -t "$to" -s smtp地址定义  -u "$subject_gb2312" -o tls=auto -o message-content-type=html -o message-charset=utf8 -xu 要发送的邮件名称比如123.qq.com  -xp  这里来个密码 -m "$message_gb2312"


# 以下是操作步骤以模板的方式

zabbix 邮件报警配置_第1张图片

zabbix 邮件报警配置_第2张图片

zabbix 邮件报警配置_第3张图片

zabbix 邮件报警配置_第4张图片

zabbix 邮件报警配置_第5张图片

zabbix 邮件报警配置_第6张图片

zabbix 邮件报警配置_第7张图片


# 最后附加上模板到主机上就齐活了,这里是超过90报警之后的信息

zabbix 邮件报警配置_第8张图片


### 最后附上zabbix 定义好的监控项模板信息,监控操作步骤:

# 路径地址:http://xiong51.blog.51cto.com/5239058/1946056


# 复制出来之后将文件命令*.xml格式:  如xx.xml然后导入



    3.2
    2017-07-11T05:25:52Z
    
        
            Templates
        
    
    
        
    
    
        
            {Templates_oracle_status:oracle.status[Process].last(30)}>135
            0
            
            oraclce_process_warning
            0
            
            
            0
            2
            oracle_process_warning
            0
            0
            
            
        
        
            {Templates_oracle_status:oracle.status[Sessions].last(30)}>135
            0
            
            oraclce_session_warning
            0
            
            
            0
            2
            
            0
            0
            
            
        
    
    
        
            oracle_status
            900
            200
            0.0000
            100.0000
            1
            1
            0
            1
            0
            0.0000
            0.0000
            0
            0
            0
            0
            
                
                    0
                    2
                    000099
                    0
                    2
                    0
                    
                        Templates_oracle_status
                        oracle.status[Process]
                    
                
                
                    1
                    2
                    999900
                    0
                    2
                    0
                    
                        Templates_oracle_status
                        oracle.status[Sessions]