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)