Browse Source

Introduce Aodh threshold alarming example

Denis Makogon 2 years ago
parent
commit
c089fbf6cf
1 changed files with 172 additions and 0 deletions
  1. 172
    0
      examples/openstack-alarms/README.md

+ 172
- 0
examples/openstack-alarms/README.md View File

@@ -0,0 +1,172 @@
1
+Integrating OpenStack Telemetry alarming with Picasso
2
+=====================================================
3
+
4
+OpenStack Aodh is the alarming service for OpenStack Telemetry.
5
+The Ceilometer service collects and transforms data from OpenStack services. 
6
+Using Aodh, users/operators are able to setup alarms to trigger based on custom rules.
7
+This is useful for autoscaling, which is provided by Heat.
8
+
9
+Deploying DevStack
10
+------------------
11
+
12
+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.
13
+In order to get DevStack use following commands:
14
+
15
+```bash
16
+export DEVSTACK_DIR=~/devstack
17
+git clone git://git.openstack.org/openstack-dev/devstack.git $DEVSTACK_DIR
18
+```
19
+
20
+Create a file, `$DEVSTACK_DIR/local.conf` with the following text:
21
+```bash
22
+[[local|localrc]]
23
+
24
+enable_plugin aodh https://git.openstack.org/openstack/aodh
25
+enable_plugin functions_plugin git@github.com:iron-io/functions-devstack-plugin.git master
26
+
27
+```
28
+Start DevStack installation
29
+```bash
30
+./stack.sh
31
+```
32
+
33
+Creating app and route
34
+----------------------
35
+
36
+Once DevStack is installed, create a Picasso app:
37
+```bash
38
+openstack fn apps create alarm-notifier-app
39
+```
40
+```
41
++-------------+--------------------------------------------------+
42
+| Field       | Value                                            |
43
++-------------+--------------------------------------------------+
44
+| name        | alarm-notifier-app-f6fdaab020e                   |
45
+| created_at  | 2016-12-12 18:08:26.077455                       |
46
+| updated_at  | 2016-12-12 18:08:26.077477                       |
47
+| project_id  | f6fdaab020ec4cdf85db3740520ec658                 |
48
+| config      | None                                             |
49
+| id          | f012ff74ea1c43b6a12c3c946fe96de5                 |
50
+| description | App for project f6fdaab020ec4cdf85db3740520ec658 |
51
++-------------+--------------------------------------------------+
52
+```
53
+
54
+Create a route:
55
+```bash
56
+openstack fn routes create alarm-notifier-app-f6fdaab020e /hello async iron/hello --is-public
57
+```
58
+```
59
++-----------------+------------+
60
+| Field           | Value      |
61
++-----------------+------------+
62
+| image           | iron/hello |
63
+| memory          | 128        |
64
+| max_concurrency | 1          |
65
+| timeout         | 30         |
66
+| path            | /hello     |
67
+| is_public       | True       |
68
+| type            | async      |
69
++-----------------+------------+
70
+```
71
+
72
+Bootstrap VM on cirros image:
73
+```bash
74
+nova boot --image $(glance image-list | awk '/cirros-0.3.4-x86_64-uec / {print $2}') --flavor 42 test_alarms
75
+```
76
+```
77
++--------------------------------------+----------------------------------------------------------------+
78
+| Property                             | Value                                                          |
79
++--------------------------------------+----------------------------------------------------------------+
80
+| OS-DCF:diskConfig                    | MANUAL                                                         |
81
+| OS-EXT-AZ:availability_zone          |                                                                |
82
+| OS-EXT-STS:power_state               | 0                                                              |
83
+| OS-EXT-STS:task_state                | scheduling                                                     |
84
+| OS-EXT-STS:vm_state                  | building                                                       |
85
+| OS-SRV-USG:launched_at               | -                                                              |
86
+| OS-SRV-USG:terminated_at             | -                                                              |
87
+| accessIPv4                           |                                                                |
88
+| accessIPv6                           |                                                                |
89
+| adminPass                            | C9bfvqY4p3Lz                                                   |
90
+| config_drive                         |                                                                |
91
+| created                              | 2016-12-12T22:17:56Z                                           |
92
+| description                          | -                                                              |
93
+| flavor                               | m1.nano (42)                                                   |
94
+| hostId                               |                                                                |
95
+| id                                   | 7a4822c5-9fd4-44af-a54e-daef65650ca7                           |
96
+| image                                | cirros-0.3.4-x86_64-uec (b60ad91d-2917-46b2-881c-0c5a277c6f8d) |
97
+| key_name                             | -                                                              |
98
+| locked                               | False                                                          |
99
+| metadata                             | {}                                                             |
100
+| name                                 | test_alarms                                                    |
101
+| os-extended-volumes:volumes_attached | []                                                             |
102
+| progress                             | 0                                                              |
103
+| security_groups                      | default                                                        |
104
+| status                               | BUILD                                                          |
105
+| tags                                 | []                                                             |
106
+| tenant_id                            | f6fdaab020ec4cdf85db3740520ec658                               |
107
+| updated                              | 2016-12-12T22:17:56Z                                           |
108
+| user_id                              | d0ec76f99e3c4e588119c8f6858a4ba3                               |
109
++--------------------------------------+----------------------------------------------------------------+
110
+
111
+```
112
+
113
+Create Aodh alarm:
114
+
115
+```bash
116
+aodh alarm create \ 
117
+    --type threshold \ 
118
+    --name cpu_high \ 
119
+    --description 'instance running hot' \ 
120
+    --meter-name cpu_util \ 
121
+    --threshold 20.0 \ 
122
+    --comparison-operator gt \ 
123
+    --statistic max \ 
124
+    --period 600 \ 
125
+    --evaluation-periods 1 \ 
126
+    --alarm-action $(openstack fn routes expose-url testapp-f6fdaab020ec4cdf85db37 /hello) \ 
127
+    --query resource_id=$(nova list | grep test_alarms | awk '{print $2}')
128
+```
129
+```
130
++---------------------------+------------------------------------------------------------------------+
131
+| Field                     | Value                                                                  |
132
++---------------------------+------------------------------------------------------------------------+
133
+| alarm_actions             | [u'http://192.168.0.114:10001/r/testapp-f6fdaab020ec4cdf85db37/hello'] |
134
+| alarm_id                  | f3460bad-2b5c-4c2f-b6e0-e82973e6ec71                                   |
135
+| comparison_operator       | gt                                                                     |
136
+| description               | instance running hot                                                   |
137
+| enabled                   | True                                                                   |
138
+| evaluation_periods        | 1                                                                      |
139
+| exclude_outliers          | False                                                                  |
140
+| insufficient_data_actions | []                                                                     |
141
+| meter_name                | cpu_util                                                               |
142
+| name                      | cpu_high                                                               |
143
+| ok_actions                | []                                                                     |
144
+| period                    | 600                                                                    |
145
+| project_id                | f6fdaab020ec4cdf85db3740520ec658                                       |
146
+| query                     | resource_id = 7a4822c5-9fd4-44af-a54e-daef65650ca7 AND                 |
147
+|                           | project_id = f6fdaab020ec4cdf85db3740520ec658                          |
148
+| repeat_actions            | False                                                                  |
149
+| severity                  | low                                                                    |
150
+| state                     | insufficient data                                                      |
151
+| state_timestamp           | 2016-12-12T22:20:48.030596                                             |
152
+| statistic                 | max                                                                    |
153
+| threshold                 | 20.0                                                                   |
154
+| time_constraints          | []                                                                     |
155
+| timestamp                 | 2016-12-12T22:20:48.030596                                             |
156
+| type                      | threshold                                                              |
157
+| user_id                   | d0ec76f99e3c4e588119c8f6858a4ba3                                       |
158
++---------------------------+------------------------------------------------------------------------+
159
+
160
+```
161
+To trigger the alarm, generate CPU load on the provisioned VM:
162
+```bash
163
+ssh cirros@10.0.0.7
164
+cirros@10.0.0.7 password: 
165
+dd if=/dev/zero of=/dev/null
166
+```
167
+Once our threshold has been reached, Aodh will notify with an HTTP Callback to our async function assigned to the route we created.
168
+
169
+Conclusion
170
+----------
171
+
172
+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.

Loading…
Cancel
Save