| 1 |
====== |
| 2 |
Events |
| 3 |
====== |
| 4 |
|
| 5 |
In addition to meters, the Telemetry service collects events triggered |
| 6 |
within an OpenStack environment. This section provides a brief summary |
| 7 |
of the events format in the Telemetry service. |
| 8 |
|
| 9 |
While a sample represents a single, numeric datapoint within a |
| 10 |
time-series, an event is a broader concept that represents the state of |
| 11 |
a resource at a point in time. The state may be described using various |
| 12 |
data types including non-numeric data such as an instance's flavor. In |
| 13 |
general, events represent any action made in the OpenStack system. |
| 14 |
|
| 15 |
Event configuration |
| 16 |
~~~~~~~~~~~~~~~~~~~ |
| 17 |
|
| 18 |
By default, ceilometer builds event data from the messages it receives from |
| 19 |
other OpenStack services. |
| 20 |
|
| 21 |
.. note:: |
| 22 |
|
| 23 |
In releases older than Ocata, it is advisable to set |
| 24 |
``disable_non_metric_meters`` to ``True`` when enabling events in the |
| 25 |
Telemetry service. The Telemetry service historically represented events as |
| 26 |
metering data, which may create duplication of data if both events and |
| 27 |
non-metric meters are enabled. |
| 28 |
|
| 29 |
Event structure |
| 30 |
~~~~~~~~~~~~~~~ |
| 31 |
|
| 32 |
Events captured by the Telemetry service are represented by five key |
| 33 |
attributes: |
| 34 |
|
| 35 |
event\_type |
| 36 |
A dotted string defining what event occurred such as |
| 37 |
``"compute.instance.resize.start"``. |
| 38 |
|
| 39 |
message\_id |
| 40 |
A UUID for the event. |
| 41 |
|
| 42 |
generated |
| 43 |
A timestamp of when the event occurred in the system. |
| 44 |
|
| 45 |
traits |
| 46 |
A flat mapping of key-value pairs which describe the event. The |
| 47 |
event's traits contain most of the details of the event. Traits are |
| 48 |
typed, and can be strings, integers, floats, or datetimes. |
| 49 |
|
| 50 |
raw |
| 51 |
Mainly for auditing purpose, the full event message can be stored |
| 52 |
(unindexed) for future evaluation. |
| 53 |
|
| 54 |
Event indexing |
| 55 |
~~~~~~~~~~~~~~ |
| 56 |
|
| 57 |
The general philosophy of notifications in OpenStack is to emit any and |
| 58 |
all data someone might need, and let the consumer filter out what they |
| 59 |
are not interested in. In order to make processing simpler and more |
| 60 |
efficient, the notifications are stored and processed within Ceilometer |
| 61 |
as events. The notification payload, which can be an arbitrarily complex |
| 62 |
JSON data structure, is converted to a flat set of key-value pairs. This |
| 63 |
conversion is specified by a config file. |
| 64 |
|
| 65 |
.. note:: |
| 66 |
|
| 67 |
The event format is meant for efficient processing and querying. |
| 68 |
Storage of complete notifications for auditing purposes can be |
| 69 |
enabled by configuring ``store_raw`` option. |
| 70 |
|
| 71 |
Event conversion |
| 72 |
---------------- |
| 73 |
|
| 74 |
The conversion from notifications to events is driven by a configuration |
| 75 |
file defined by the ``definitions_cfg_file`` in the ``ceilometer.conf`` |
| 76 |
configuration file. |
| 77 |
|
| 78 |
This includes descriptions of how to map fields in the notification body |
| 79 |
to Traits, and optional plug-ins for doing any programmatic translations |
| 80 |
(splitting a string, forcing case). |
| 81 |
|
| 82 |
The mapping of notifications to events is defined per event\_type, which |
| 83 |
can be wildcarded. Traits are added to events if the corresponding |
| 84 |
fields in the notification exist and are non-null. |
| 85 |
|
| 86 |
.. note:: |
| 87 |
|
| 88 |
The default definition file included with the Telemetry service |
| 89 |
contains a list of known notifications and useful traits. The |
| 90 |
mappings provided can be modified to include more or less data |
| 91 |
according to user requirements. |
| 92 |
|
| 93 |
If the definitions file is not present, a warning will be logged, but an |
| 94 |
empty set of definitions will be assumed. By default, any notifications |
| 95 |
that do not have a corresponding event definition in the definitions |
| 96 |
file will be converted to events with a set of minimal traits. This can |
| 97 |
be changed by setting the option ``drop_unmatched_notifications`` in the |
| 98 |
``ceilometer.conf`` file. If this is set to ``True``, any unmapped |
| 99 |
notifications will be dropped. |
| 100 |
|
| 101 |
The basic set of traits (all are TEXT type) that will be added to all |
| 102 |
events if the notification has the relevant data are: service |
| 103 |
(notification's publisher), tenant\_id, and request\_id. These do not |
| 104 |
have to be specified in the event definition, they are automatically |
| 105 |
added, but their definitions can be overridden for a given event\_type. |
| 106 |
|
| 107 |
Event definitions format |
| 108 |
------------------------ |
| 109 |
|
| 110 |
The event definitions file is in YAML format. It consists of a list of |
| 111 |
event definitions, which are mappings. Order is significant, the list of |
| 112 |
definitions is scanned in reverse order to find a definition which |
| 113 |
matches the notification's event\_type. That definition will be used to |
| 114 |
generate the event. The reverse ordering is done because it is common to |
| 115 |
want to have a more general wildcarded definition (such as |
| 116 |
``compute.instance.*``) with a set of traits common to all of those |
| 117 |
events, with a few more specific event definitions afterwards that have |
| 118 |
all of the above traits, plus a few more. |
| 119 |
|
| 120 |
Each event definition is a mapping with two keys: |
| 121 |
|
| 122 |
event\_type |
| 123 |
This is a list (or a string, which will be taken as a 1 element |
| 124 |
list) of event\_types this definition will handle. These can be |
| 125 |
wildcarded with unix shell glob syntax. An exclusion listing |
| 126 |
(starting with a ``!``) will exclude any types listed from matching. |
| 127 |
If only exclusions are listed, the definition will match anything |
| 128 |
not matching the exclusions. |
| 129 |
|
| 130 |
traits |
| 131 |
This is a mapping, the keys are the trait names, and the values are |
| 132 |
trait definitions. |
| 133 |
|
| 134 |
Each trait definition is a mapping with the following keys: |
| 135 |
|
| 136 |
fields |
| 137 |
A path specification for the field(s) in the notification you wish |
| 138 |
to extract for this trait. Specifications can be written to match |
| 139 |
multiple possible fields. By default the value will be the first |
| 140 |
such field. The paths can be specified with a dot syntax |
| 141 |
(``payload.host``). Square bracket syntax (``payload[host]``) is |
| 142 |
also supported. In either case, if the key for the field you are |
| 143 |
looking for contains special characters, like ``.``, it will need to |
| 144 |
be quoted (with double or single quotes): |
| 145 |
``payload.image_meta.`org.openstack__1__architecture```. The syntax |
| 146 |
used for the field specification is a variant of |
| 147 |
`JSONPath <https://github.com/kennknowles/python-jsonpath-rw>`__ |
| 148 |
|
| 149 |
type |
| 150 |
(Optional) The data type for this trait. Valid options are: |
| 151 |
``text``, ``int``, ``float``, and ``datetime``. Defaults to ``text`` |
| 152 |
if not specified. |
| 153 |
|
| 154 |
plugin |
| 155 |
(Optional) Used to execute simple programmatic conversions on the |
| 156 |
value in a notification field. |
| 157 |
|
| 158 |
Event delivery to external sinks |
| 159 |
-------------------------------- |
| 160 |
|
| 161 |
You can configure the Telemetry service to deliver the events |
| 162 |
into external sinks. These sinks are configurable in the |
| 163 |
``/etc/ceilometer/event_pipeline.yaml`` file. |
| 164 |
|