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