Ask Your Question
1

ceilometer alarm server handler

asked 2014-11-24 08:48:01 -0500

chitranshi-shubham gravatar image

hello,

I have created an alarm from the CLI that checks if the cpu_util is greater than a threshold for a VM, I have given a http url in my alarm action as "http://localhost:8080", in order to test the web hook i have created a simple python server using SimpleHTTPServer and CGIRequestHandler, but I am not getting any response in json or XML. Does the alarm uses POST or PUT ? Simply put How to get the response json from alarm ? A simple code snippet would be a great help.

Thanks.!!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-12-13 07:55:55 -0500

chitranshi-shubham gravatar image

updated 2014-12-15 07:22:59 -0500

simply put, this is not a question for ceilometer alarm, but a question on how web hook work. the ceilometer alarm POST on the URL provided, in JSON, we can listen on the URL and get response. this is how we can do it. as a simple example, use python-flask, a micro framework. here is a code snippet that listens on port 8080 and returns the JSON

from flask import Flask
from flask import request

app = Flask(__name__)

@app.route("/", methods = ['POST'])
def alarm():
    print(request.get_json())
    return "thanks ceilometer alarm for the notification"

app.run()

this is a ceilometer alarm notification handler.!!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-11-24 08:48:01 -0500

Seen: 143 times

Last updated: Dec 15 '14