Configure the Environment:
Zabbix 2.2.15
1. Configuring the type of warning media
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/908239/201612/908239-20161213145452495-233391139. PNG "style=" border:0px; "/>
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/908239/201612/908239-20161213145537714-1901108728. PNG "style=" border:0px; "/>
This file is located in:/usr/lib/zabbix/alertscripts/
Must have execute permissions and change the owning user and group
To modify the path of this script, you need to modify the zabbix_server.conf
Alertscriptspath=/usr/lib/zabbix/alertscripts
Script content:
#!/bin/bash
#
# Filename:sendSMS.sh
# revision:1.0
# DATE:2016/12/13
# Author:wang
# Email:
# Description:zabbix SMS Alarm Script
# Notes: SMS Gateway uses the Chinese network built SMS Messenger
#
# Script's log file
Logfile= "/tmp/sms.log"
:> "$LOGFILE"
exec 1> "$LOGFILE"
EXEC 2>&1
# UID and key values need to be modified by themselves, http://www.smschinese.cn/api.shtml
# Uid Website User name
# Key Interface Secret key
Uid= "XXXXXX"
key= "XXXXXX"
mobile_number=$1# Mobile phone Number
message_utf8=$3# SMS Content
Xxd= "/usr/bin/xxd"
Curl= "/usr/bin/curl"
Timeout=5
# SMS content to be URL-encoded processing, in addition to the following method, can also be implemented with the--data-urlencode option of curl.
Message_encode=$ (echo "$MESSAGE _utf8" | ${xxd}-ps | sed ' s/\ (... \)/%\1/g ' | Tr-d ' \ n ')
# SMS API
Url= "Http://utf8.sms.webchinese.cn/?uid=${uid}&key=${key}&smsmob=${mobile_number}&smstext=${message_encode}"
# Send It
Set-x
${curl}-S--connect-timeout ${timeout} "${url}"
Replace the chain to their own on the test, curl is not very useful, you can use ELinks instead!
2. Then create the user
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/908239/201612/908239-20161213151038776-1093939290. PNG "style=" border:0px; "/>
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/908239/201612/908239-20161213151206948-1335098426. PNG "style=" border:0px; "/>
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/908239/201612/908239-20161213151425136-1735505651. PNG "style=" border:0px; "/>
3. Next, configure the alarm action
1, select the system configuration----"Action----" Create action Creation action
2. Configure the operation name and alarm message content
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/908239/201612/908239-20161213150405058-814153232. PNG "style=" border:0px; "/>
Subject: {TRIGGER. STATUS}: {Trigger.name}
Alarm host: {host.name}
Host IP: {host. IP}
Status: {TRIGGER. STATUS}
Alarm time: {EVENT. DATE} {EVENT. TIME}
Warning message: {trigger.name}
Alarm level: {TRIGGER. SEVERITY}
Trigger URL: {Trigger. URL}
Problem Details: {item.name}:{item. VALUE}
Event ID: {event.id}
3. Set the conditions according to your own needs
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/908239/201612/908239-20161213150609026-193494518. PNG "style=" border:0px; "/>
4. Defining actions
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/908239/201612/908239-20161213150719901-14778615. PNG "style=" border:0px; "/>
The last is to trigger the alarm to test, it is important to note that the SMS channel can not often send SMS, we test the time to pay attention to the frequency of transmission!
This article is from "Linux Operations Technology" blog, please be sure to keep this source http://forall.blog.51cto.com/12356505/1882979
Zabbix implementation of SMS alarm settings (actual combat)