Quantcast
Channel: Ask OpenStack: Q&A Site for OpenStack Users and Developers - Individual question feed
Viewing all articles
Browse latest Browse all 9

Answer by Bernd Bausch for How can I use Ceilometers alarm service to perform a custom task like, if the cpu_util metric is really high on one of the node, then perform migration of the VMs to another node (run the migrate command to perform migration) ?

Previous: Comment by ShubhamMeshram for 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.
$
0
0
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 {"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.

Viewing all articles
Browse latest Browse all 9

Trending Articles