diff --git a/examples/openstack-alarms/README.md b/examples/openstack-alarms/README.md index 2c94a05..126e63a 100644 --- a/examples/openstack-alarms/README.md +++ b/examples/openstack-alarms/README.md @@ -1,13 +1,11 @@ -Integrating OpenStack Telemetry alarming with Picasso -===================================================== +## Integrating OpenStack Telemetry alarming with Picasso + OpenStack Aodh is the alarming service for OpenStack Telemetry. -The Ceilometer service collects and transforms data from OpenStack services. +The Ceilometer service collects and transforms data from OpenStack services. Using Aodh, users/operators are able to setup alarms to trigger based on custom rules. -This is useful for autoscaling, which is provided by Heat. -Deploying DevStack ------------------- +### Deploying DevStack To see how Aodh can be integrated with Picasso, we recommend using DevStack as the simplest and fastest way to get both Aodh and Picasso services running along with Nova, Glance and Neutron services. In order to get DevStack use following commands: @@ -18,26 +16,51 @@ git clone git://git.openstack.org/openstack-dev/devstack.git $DEVSTACK_DIR ``` Create a file, `$DEVSTACK_DIR/local.conf` with the following text: + ```bash [[local|localrc]] enable_plugin aodh https://git.openstack.org/openstack/aodh -enable_plugin functions_plugin git@github.com:iron-io/functions-devstack-plugin.git master +enable_plugin picasso git@github.com:iron-io/picasso.git +# Picasso configuration +PICASSO_REPO=${PICASSO_REPO:-git@github.com:iron-io/picasso.git} +PICASSO_BRANCH=${PICASSO_BRANCH:-master} +PICASSO_DIR=${PICASSO_DIR:-${DEST}/picasso} +PICASSO_PORT=${PICASSO_PORT:-10001} +PICASSO_LOG_LEVEL=${PICASSO_LOG_LEVEL:-DEBUG} +PICASSO_LOG_FILE=${PICASSO_LOG_FILE:-/var/log/picasso-api.log} + +# Picasso client configuration +PICASSO_CLIENT_REPO=${PICASSO_CLIENT_REPO:-git@github.com:iron-io/python-picassoclient.git} +PICASSO_CLIENT_DIR=${PICASSO_CLIENT_DIR:-${DEST}/python-picassoclient} +PICASSO_CLIENT_BRANCH=${PICASSO_CLIENT_BRANCH:-master} + +# Functions parameters +FUNCTIONS_REPO=${FUNCTIONS_REPO:-git@github.com:iron-io/functions.git} +FUNCTIONS_BRANCH=${FUNCTIONS_BRANCH:-master} +FUNCTIONS_PORT=${FUNCTIONS_PORT:-10501} +FUNCTIONS_DB=${FUNCTIONS_DBPATH:-bolt://$FUNCTIONS_DIR/devstack.functions.storage.db?bucket=funcs} +FUNCTIONS_MQ=${FUNCTIONS_DBPATH:-bolt://$FUNCTIONS_DIR/devstack.functions.queue.db} +FUNCTIONS_LOG_LEVEL=${FUNCTIONS_LOG_LEVEL:-DEBUG} + +DOCKERD_OPTS=${DOCKERD_OPTS:---dns 8.8.8.8 --dns 8.8.4.4 --storage-driver=overlay2 -H fd://} ``` + Start DevStack installation + ```bash ./stack.sh ``` -Creating app and route ----------------------- +### Creating app and route + Once DevStack is installed, create a Picasso app: + ```bash openstack fn apps create alarm-notifier-app -``` -``` + +-------------+--------------------------------------------------+ | Field | Value | +-------------+--------------------------------------------------+ @@ -54,8 +77,7 @@ openstack fn apps create alarm-notifier-app Create a route: ```bash openstack fn routes create alarm-notifier-app-f6fdaab020e /hello async iron/hello --is-public -``` -``` + +-----------------+------------+ | Field | Value | +-----------------+------------+ @@ -72,8 +94,7 @@ openstack fn routes create alarm-notifier-app-f6fdaab020e /hello async iron/hell Bootstrap VM on cirros image: ```bash nova boot --image $(glance image-list | awk '/cirros-0.3.4-x86_64-uec / {print $2}') --flavor 42 test_alarms -``` -``` + +--------------------------------------+----------------------------------------------------------------+ | Property | Value | +--------------------------------------+----------------------------------------------------------------+ @@ -107,26 +128,24 @@ nova boot --image $(glance image-list | awk '/cirros-0.3.4-x86_64-uec / {print $ | updated | 2016-12-12T22:17:56Z | | user_id | d0ec76f99e3c4e588119c8f6858a4ba3 | +--------------------------------------+----------------------------------------------------------------+ - ``` Create Aodh alarm: ```bash -aodh alarm create \ - --type threshold \ - --name cpu_high \ - --description 'instance running hot' \ - --meter-name cpu_util \ - --threshold 20.0 \ - --comparison-operator gt \ - --statistic max \ - --period 600 \ - --evaluation-periods 1 \ - --alarm-action $(openstack fn routes expose-url testapp-f6fdaab020ec4cdf85db37 /hello) \ +aodh alarm create \ + --type threshold \ + --name cpu_high \ + --description 'instance running hot' \ + --meter-name cpu_util \ + --threshold 20.0 \ + --comparison-operator gt \ + --statistic max \ + --period 600 \ + --evaluation-periods 1 \ + --alarm-action $(openstack fn routes expose-url testapp-f6fdaab020ec4cdf85db37 /hello) \ --query resource_id=$(nova list | grep test_alarms | awk '{print $2}') -``` -``` + +---------------------------+------------------------------------------------------------------------+ | Field | Value | +---------------------------+------------------------------------------------------------------------+ @@ -156,17 +175,17 @@ aodh alarm create \ | type | threshold | | user_id | d0ec76f99e3c4e588119c8f6858a4ba3 | +---------------------------+------------------------------------------------------------------------+ - ``` + To trigger the alarm, generate CPU load on the provisioned VM: + ```bash ssh cirros@10.0.0.7 cirros@10.0.0.7 password: dd if=/dev/zero of=/dev/null ``` + Once our threshold has been reached, Aodh will notify with an HTTP Callback to our async function assigned to the route we created. -Conclusion ----------- - +### Conclusion Picasso's ability to provide public sync/async function routes can be used to integrate with web hooks, such as Aodh, the OpenStack Telemetry alarming service.