How to send alert text messages using Apsara in centos

Source: Internet
Author: User
1, go to the official website http://bbs.it-adv.net/viewthread.php? Tid = 1081 & amp; extra = page % 3D1 download the fetion program installation package on the corresponding platform 2. First, register a member on this website and reply to the post. then download the fetion robot main program fetion on the linux platform and the corresponding linux version of the lib package 3, the main program and the corresponding lib in the same directory sms 4, so that the main program has the permissions to execute 1, go to the official website http://bbs.it-adv.net/viewthread.php? Tid = 1081 & extra = page % 3D1 download the Apsara program installation package on the corresponding Platform
2. First, register a member on the website and reply to the post. Then, download the fetion robot main program fetion on the linux platform and the lib package of the corresponding linux version.
3. Place the main program and corresponding lib in the same directory sms
4. Grant the master program the permission to execute chmod a + x fetion
5. Enter the sms directory and run the following command LD_LIBRARY_PATH = ../fetion
6. prompts that all the parameters used by fetion in linux are as follows:
-- Mobile = [mobile phone number] login mobile phone number
-- Sid = [flying signal] login flying Signal
-- Pwd = [Password] logon Password
-- Config = [file name] indicates the file storing the mobile phone number and password.
-- Index = [index number] index
The following parameters provide the receiver
-- To = [mobile phone number/flying signal/URI] mobile phone number/flying signal/URI for receiving messages. if you know the URI of the peer, you only need to be in the Peer friend list, and you do not need to send the peer in the Peer friend list.
Multiple numbers are supported, separated by commas (,).
-- Msg-utf8 = [info]
The sent message, which is UTF-8 encoded.
-- Msg-gb = [information]
Sent message, in GB encoding
-- File-utf8 = [file utf8 format]
Send File Content
-- File-gb = [file gb format]
Send File Content
-- Msg-type = [0/1/2]
Message sending type: Short Message
Gadgets
-- Query-cmcc-no: query Mobile Phone Segments of a mobile company
7. Enter the following information according to the parameter prompt:
LD_LIBRARY_PATH = ../fetion -- mobile = 15264171136 -- pwd = yourpwd -- to = 15264171136 -- msg-utf8 = hello
When this error occurs, the system will find that a mobile phone number 15268241136.jpg actually prompts the user to enter the verification code, in this case, we can download the images dynamically generated in the same directory as the main program to the local device and use the image browsing tool to open the images. Then, enter the corresponding verification code into the thrown exception program and press ENTER OK to receive the image. the text message sent. 8. Actual script when the standby host takes over the resource host is down, send an alert text message to the host Administrator using fetion #! /Bin/bash
# Author fengzhanhai
# Create date 20120601
# The program is used by mon heartbeat
Sendsms ()
{
Mypath =/root/mon
Cd $ mypath
Admin = your telphone
Mykey = yourpassword
For mynum in 'cat userphone.doc'
Login userphone.doc is the list of phone books to be sent
Do
LD_LIBRARY_PATH = .. /fetion -- mobile = $ admin -- pwd = $ mykey -- to = $ mynum -- msg-utf8 = "The master server disaster, the slave server has been boot"> sms. log
Done
}
Mydir =/root/mon
Cd $ mydir
/Sbin/ifconfig eth0: 0> myip
Grep '1970. 168.202.56 'myip>/dev/null 2> & 1
If [$? -Eq 0] &! [-F ha. lock]
Then
Touch ha. lock;
Echo "'date' The shell is flushing route table"> ha. log
/Sbin/arping-I eth0-c 3-s 192.168.202.56 192.168.202.1> ha. log
Sendsms;
Echo "'date' the route table has been success update"> ha. log
Else
Grep '1970. 168.202.56 'myip>/dev/null 2> & 1
If [$? -Eq 1];
Then
If [-f ha. lock];
Then
Rm-rf ha. lock;
Fi
Fi
Fi
Related Article

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.