Setup notifier actions in Aodh alarm

Source: Internet
Author: User

Aodh Alarm NOTIFIER ==>

alarm_actions url:http://

NOTIFIER would resolve the URL and post the data to HTTP server

Setup a Http server ==>

Such as:python-m Simplehttpserver 8000

Link:https://docs.python.org/2/library/simplehttpserver.html

Note:this case is only receive the posted data and not handle it.

such as:

[Email protected]:~$Catreflect.py #!/usr/bin/Envpython# reflects the requests from HTTP methods GET, POST, PUT, and delete# written by Nathan Hamiel ( .) from Basehttpserver import httpserver, basehttprequesthandlerfrom optparse import Optionparserclass RequestHandler (Basehttprequesthandler): def do_get (self): Request_path=Self.path Print ("\ n-----Request Start----->\n") print (request_path) print (self.headers) print ("<-----Request End-----\ n") Self.send_response ( $) Self.send_header ("Set-cookie","Foo=bar") def do_post (self): Request_path=Self.path Print ("\ n-----Request Start----->\n") print (Request_path) request_headers=self.headers content_length= Request_headers.getheaders ('Content-length') Length=int(content_length[0])ifContent_lengthElse 0Print ( request_headers) print (self.rfile.read (length)) Print ("<-----Request End-----\ n") Self.send_response ( $) Do_put=do_post Do_delete=do_get def Main (): Port=8000Print ('Listening on localhost:%s'%port) Server= Httpserver (('0.0.0.0', Port), RequestHandler) Server.serve_forever ()if__name__ = ="__main__": Parser=optionparser () parser.usage= ("Creates an http-server that would echo out any GET or POST parameters\n"                    "run:\n\n"                    "reflect") (options, args)=Parser.parse_args () main ()

Setup notifier actions in Aodh alarm

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.