Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In the alarm definition, you provide a URL to which Ceilometer sends an http POST. You need a program that listens for the http POST and takes action.

A script that listens to POSTs could be built around the nc (netcat) program.

As an example, set this alarm:

$ openstack alarm create --name cpuhigh --type threshold --statistic avg --meter-name cpu_util --comparison-operator gt --threshold 70 --period 60 --query resource_id=INSTANCE_UUID --alarm-action http://localhost:1234 --ok-action http://localhost:1234

and process it like this:

$ nc -lknv 1234

The output of the nc program might look like this:

Connection from [127.0.0.1] port 1234 [tcp/*] accepted (family 2, sport 38668)
POST / HTTP/1.1
<a few HTTP headers>
{"severity": "low", "alarm_name": "cpuhigh", "current": "alarm", "alarm_id": "0231eadd-4f42-4741-adc6-15b789c6d5b9", "reason": "Transition to alarm due to 1 samples outside threshold, most recent: 80.2078739279", "reason_data": {"count": 1, "most_recent": 80.20787392791595, "type": "threshold", "disposition": "outside"}, "previous": "insufficient data"}

Alternatively, you can ask Ceilometer to write to a log file instead of submitting a POST.