ZABBIX3 Configuring SMS Alarms

Source: Internet
Author: User

Requirements: In the Zabbix server configuration SMS Alarm, when the service failure to reach the alert level is sent by SMS to inform the operator, in order to timely processing.

First, Zabbix server-side configuration SMS Script

My SMS script placement is/etc/zabbix/alertscripts, which must be released in the/etc/zabbix/zabbix_server.conf config file alertscriptspath=/etc/zabbix/ Alertscripts

Enter/etc/zabbix/alertscripts directory, create SMS alarm script sendsms.sh, content into the following:

#!/bin/log file for bash# script logfile="/var/log/zabbix/sms.log":>"$LOGFILE"exec1>"$LOGFILE"exec2>&1Mobile_number=$1# Mobile 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, you can also use Curl--data-The urlencode option is implemented. Message_encode=$ (Echo"$MESSAGE _utf8"| ${XXD}-ps | Sed's/\ (.. \)/%\1/g'| Tr-d'\ n') # SMS API interface username and secret key account="jinrgcxxx"PASS="Jinr1234xxxooxx"URL="Http://222.73.117.158/msg/httpbatchsendsm?account=${account}&pswd=${pass}&mobile=${mobile_number} &msg=${message_encode}&needstatus=true"# Send ItSet-X${curl}-S--connect-timeout ${timeout}"${url}"

Then execute the following command to set the script and log file permissions:

touch/tmp//tmp//etc/zabbix/alertscripts/+x/etc/zabbix/alertscripts/sendsms.sh

Manual test Script:

"" " Dear customer, your order has been shipped out of the library, is in the delivery, please be patient. "

The first parameter of the script is the mobile number, the second parameter is not used, the line is empty, and the third parameter is the text message content.

After the script executes, the return value is viewed into the log file/tmp/sms.log, and if the greater than 0 represents a successful send, less than 0 send fails.

second, in the Zabbix Web interface Configuration alarm mode (Media types)

Reference Document: http://www.sxt.cn/u/756/blog/3198

ZABBIX3 Configuring SMS Alarms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.