| 1 |
The :program:`aodh` shell utility |
| 2 |
========================================= |
| 3 |
|
| 4 |
.. program:: aodh |
| 5 |
.. highlight:: bash |
| 6 |
|
| 7 |
The :program:`aodh` shell utility interacts with Aodh API |
| 8 |
from the command line. It supports the entirety of the Aodh API. |
| 9 |
|
| 10 |
You'll need to provide :program:`aodh` with your OpenStack credentials. |
| 11 |
You can do this with the ``--os-username``, ``--os-password``, |
| 12 |
``--os-tenant-id`` and ``--os-auth-url`` options, but it's easier to |
| 13 |
just set them as environment variables: |
| 14 |
|
| 15 |
.. envvar:: OS_USERNAME |
| 16 |
|
| 17 |
Your OpenStack username. |
| 18 |
|
| 19 |
.. envvar:: OS_PASSWORD |
| 20 |
|
| 21 |
Your password. |
| 22 |
|
| 23 |
.. envvar:: OS_TENANT_NAME |
| 24 |
|
| 25 |
Project to work on. |
| 26 |
|
| 27 |
.. envvar:: OS_AUTH_URL |
| 28 |
|
| 29 |
The OpenStack auth server URL (keystone). |
| 30 |
|
| 31 |
For example, in Bash you would use:: |
| 32 |
|
| 33 |
export OS_USERNAME=user |
| 34 |
export OS_PASSWORD=pass |
| 35 |
export OS_TENANT_NAME=myproject |
| 36 |
export OS_AUTH_URL=http://auth.example.com:5000/v2.0 |
| 37 |
|
| 38 |
The command line tool will attempt to reauthenticate using your provided credentials |
| 39 |
for every request. You can override this behavior by manually supplying an auth |
| 40 |
token using ``--aodh-endpoint`` and ``--os-auth-token``. You can alternatively |
| 41 |
set these environment variables:: |
| 42 |
|
| 43 |
export AODH_ENDPOINT=http://aodh.example.org:8041 |
| 44 |
export OS_AUTH_PLUGIN=token |
| 45 |
export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155 |
| 46 |
|
| 47 |
Also, if the server doesn't support authentication, you can provide |
| 48 |
``--os-auth-plugin`` aodh-noauth, ``--aodh-endpoint``, ``--user-id`` |
| 49 |
and ``--project-id``. You can alternatively set these environment variables:: |
| 50 |
|
| 51 |
export OS_AUTH_PLUGIN=aodh-noauth |
| 52 |
export AODH_ENDPOINT=http://aodh.example.org:8041 |
| 53 |
export AODH_USER_ID=99aae-4dc2-4fbc-b5b8-9688c470d9cc |
| 54 |
export AODH_PROJECT_ID=c8d27445-48af-457c-8e0d-1de7103eae1f |
| 55 |
|
| 56 |
From there, all shell commands take the form:: |
| 57 |
|
| 58 |
aodh <command> [arguments...] |
| 59 |
|
| 60 |
Run :program:`aodh help` to get a full list of all possible commands, |
| 61 |
and run :program:`aodh help <command>` to get detailed help for that |
| 62 |
command. |
| 63 |
|
| 64 |
Examples |
| 65 |
-------- |
| 66 |
|
| 67 |
Create a Ceilometer threshold alarm:: |
| 68 |
|
| 69 |
openstack alarm create --name alarm1 --description 'CPU High Average' \ |
| 70 |
--type threshold --meter-name cpu_util \ |
| 71 |
--threshold 5 --comparison-operator gt --statistic avg \ |
| 72 |
--period 60 --evaluation-periods 3 \ |
| 73 |
--query "metadata.user_metadata.stack=$heat_stack_id" \ |
| 74 |
--alarm-action 'log://' |
| 75 |
|
| 76 |
Create a Gnocchi threshold alarm:: |
| 77 |
|
| 78 |
openstack alarm create -t gnocchi_resources_threshold --name alarm1 \ |
| 79 |
--metric cpu_util --threshold 5 --resource_id <RES_ID> \ |
| 80 |
--resource_type generic --aggregation_method mean --project-id <PROJ_ID> |
| 81 |
|
| 82 |
List alarms:: |
| 83 |
|
| 84 |
openstack alarm list |
| 85 |
|
| 86 |
List alarm with query parameters:: |
| 87 |
|
| 88 |
openstack alarm list --query "state=alarm and type=gnocchi_resources_threshold" |
| 89 |
|
| 90 |
Show an alarm's history:: |
| 91 |
|
| 92 |
openstack alarm-history show <ALARM_ID> |
| 93 |
|
| 94 |
Search alarm history data:: |
| 95 |
|
| 96 |
openstack alarm-history search --query 'timestamp>"2016-03-09T01:22:35"' |
| 97 |
|