Python real-combat series of RTX send alarm message (04)

Source: Internet
Author: User

background : In the work environment, often need to monitor and alarm mutual coordination, such as basic monitoring, process monitoring, business monitoring, when triggered monitoring, you can send SMS, mail, or RTX, aspects of the administrator in the first time, to learn the health of the system, thus the system management.


Program Content :

vim send_warning.py #!/usr/bin/env python#_*_ coding:utf8 _*_# from Happy Lab import  Urllibimport urllib2def send_warning (receiver,title,content):          '          send rtx alert message           "        rtx_url =  http://rtx_url:port"          data = {                  "AppId"           :123,                 "AppKey"         : ' Rtx_password ',                  "UserName"       :receiver,                  "title"           :title,                  "Content"        :content         }                 postdata = urllib.urlencode (data)         req =  urllib2. Request (rtx_url,postdata)         response = urllib2.urlopen ( REQ)                 if __ name__ ==  "__main__":         send_warning (' Happy ', ' Test title ', ' Test content sent to Happy ')


Test Results :

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s2.51cto.com/wyfs02/m02/79/28/wkiom1akmwrwgrsaaaagkn5hmac741.png "title=" 2oo9x4]b2s_k6y{o7vwrik0.png "alt=" Wkiom1akmwrwgrsaaaagkn5hmac741.png "/>

This article is from the "Happy Lab" blog, so be sure to keep this source http://happylab.blog.51cto.com/1730296/1731430

Python real-combat series of RTX send alarm message (04)

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.