Using micro-letter public platform to monitor and manage Linux servers

Source: Internet
Author: User
Tags cdata xpath linux

Recently lazy to do operation Dimension Automation, see the marketing department colleagues in the call public platform interface, feel very interesting ~ want to try this management simple management Linux host, and push alarm information.

It is intended that this period of time will mainly expand the application ~

Add some dangerous characters to the judgment and you can specify an escape character yourself

2 for post data encryption, such as 555ifconfig this 555 is the password, in the backend will be judged, no 555 of all orders will not be executed

3 micro-letter platform can also restore some graphics and text, I can put the flow chart, or a variety of RRD library inside the map, to the client

Application for micro-trust public platform

Reference Http://mp.weixin.qq.com/cgi-bin/readtemplate?t=wxm-callbackapi-doc&lang=zh_CN

Micro-Credit public platform official site application account http://mp.weixin.qq.com/

Login to public platform, click Set--> Custom reply--> call public platform

Fill in your URL address in the URL, please fill in the Token according to your personal situation and remember, this Token is your random string. To prevent others from embezzling.

Click Submit, prompt to submit successful words.

How do I make it happen ~

I sent a message in the past, the micro-letter is to post the message to your server, and then I get what you want to check, I call the Linux command, or the function has been written, the results, and finally returned to the customer.

Must be 80 port, micro-letter interface is very two ~

Python app.py 80

#-*-Coding:utf-8-*-from bottle import Debug, Default_app, run, get, request, post import sys, OS, time, Lib Xml2dom @get ('/') def index (): Return request. Get.get (' Echostr ') @post ('/') def index_post (): For key, value in request. Post.allitems (): doc = libxml2dom.parsestring (key) _to = Doc.xpath ('//fromusername ') [0].textcont ENT _from = Doc.xpath ('//tousername ') [0].textcontent cmd = Doc.xpath ('//content ') [0].text Content aa=os.popen (cmd). Read () return "" <xml> <tousername><! [cdata[%s]]></tousername> <fromusername><! [cdata[%s]]></fromusername> <CreateTime>%s</CreateTime> <msgtype><! [cdata[text]]></msgtype> <content><! [cdata[%s]]></content> <FuncFlag>0</FuncFlag> </xml> "" "% (_to, _from, int (Time.time ()),     
       Aa 
if __name__ = = "__main__": # Interactive Mode Debug (True) port = Int (sys.argv[1] If Len (SYS.A     
    RGV) > 1 else 8888) run (host= ' 0.0.0.0 ', Portport=port, reloader=true) Else: # Mod WSGI Launch Os.chdir (Os.path.dirname (__file__)) app = Default_app ()

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.