Skip to content

Commit 8101668

Browse files
committed
Add docs for configuring CloudKitty
1 parent 6a20fe7 commit 8101668

File tree

2 files changed

+126
-0
lines changed

2 files changed

+126
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
==========
2+
CloudKitty
3+
==========
4+
5+
Configuring in kayobe-config
6+
============================
7+
8+
By default, CloudKitty uses Gnocci and Ceilometer as the collector and fetcher
9+
backends. Unless the system has a specific reason not to, we recommend instead
10+
using Prometheus as the backend for both. The following instructions explain
11+
how to do this
12+
13+
Enable CloudKitty and disable InfluxDB, as we are using OpenSearch as the
14+
storage backend. Set the following in ``kolla.yml``:
15+
16+
.. code-block:: console
17+
18+
kolla_enable_cloudkitty: true
19+
# Explicitly disable influxdb as we are using OpenSearch as the CloudKitty backend
20+
kolla_enable_influxdb: false
21+
22+
Use Prometheus as the collector and fetcher backends, and Elasticsearch as the
23+
storage backend. Note that this is patched in our fork of CloudKitty to also
24+
work with OpenSearch. Proper support is still pending in Kolla-Ansible `here
25+
<https://review.opendev.org/c/openstack/kolla-ansible/+/898555>`__. If you have
26+
TLS enabled, you will also need to allow insecure connections for Prometheus
27+
and Elasticsearch. Set the following in ``kolla/globals.yml``:
28+
29+
.. code-block:: console
30+
31+
cloudkitty_collector_backend: prometheus
32+
cloudkitty_fetcher_backend: prometheus
33+
cloudkitty_storage_backend: elasticsearch
34+
cloudkitty_elasticsearch_insecure_connections: true
35+
cloudkitty_prometheus_insecure_connections: true
36+
37+
The default collection period is one hour, which is likely too long for your
38+
system. CloudKitty will charge for the entire period if any usage is seen
39+
within this timeframe. This means that even just one minute will be counted as
40+
an hour's usage. It is recommended to change this to a lower number, such as
41+
ten minutes. When using Prometheus as the collector, you need to change the
42+
scope_key to match the metrics provided by the Prometheus OpenStack Exporter.
43+
Set the following in ``cloudkitty.conf``:
44+
45+
.. code-block:: console
46+
47+
[collect]
48+
scope_key = tenant_id
49+
period = 600
50+
51+
You will need to configure which metrics CloudKitty should track. This example
52+
will track for flavors and volumes, set in
53+
``kolla/config/cloudkitty/metrics.yml``:
54+
55+
.. code-block:: console
56+
57+
metrics:
58+
openstack_nova_server_status:
59+
alt_name: instance
60+
groupby:
61+
- uuid
62+
- user_id
63+
- tenant_id
64+
metadata:
65+
- flavor_id
66+
- name
67+
mutate: MAP
68+
mutate_map:
69+
0.0: 1.0 # ACTIVE
70+
11.0: 1.0 # SHUTOFF
71+
12.0: 1.0 # SUSPENDED
72+
16.0: 1.0 # PAUSED
73+
unit: instance
74+
openstack_cinder_limits_volume_used_gb:
75+
alt_name: storage
76+
unit: GiB
77+
groupby:
78+
- tenant_id
79+
80+
TODO: Should we explain how to handle OpenStack exporter metrics relabelling,
81+
for the case where a system may have had Monasca deployed in the past?
82+
83+
Post-configuration with openstack-config
84+
========================================
85+
86+
This is an example `openstack-config
87+
<https://github.com/stackhpc/openstack-config>`__ setup to create mappings for
88+
the metrics configured above. Note that the costs are scaled for the ten-minute
89+
collection period, e.g. a flavor with 1 VCPU will cost 1 unit per hour.
90+
91+
.. code-block:: yaml
92+
93+
# Map flavors based on VCPUs
94+
openstack_ratings_hashmap_field_mappings:
95+
- service: instance
96+
name: flavor_id
97+
mappings:
98+
- value: '1' # tiny compute flavor (1 vcpu) with an OpenStack flavor ID of 1
99+
cost: 0.1666666666666666
100+
type: flat
101+
- value: '2' # small compute flavor (2 vcpus) with an OpenStack flavor ID of 2
102+
cost: 0.3333333333333333
103+
type: flat
104+
- value: '3' # medium compute flavor (3 vcpus) with an OpenStack flavor ID of 3
105+
cost: 0.5
106+
type: flat
107+
- value: '4' # large compute flavor (4 vcpus) with an OpenStack flavor ID of 4
108+
cost: 0.6666666666666666
109+
type: flat
110+
- value: '5' # xlarge compute flavor (8 vcpus) with an OpenStack flavor ID of 5
111+
cost: 1.3333333333333333
112+
type: flat
113+
- value: '6' # tiny 2 compute flavor (2 vcpus) with an OpenStack flavor ID of 6
114+
cost: 0.3333333333333333
115+
type: flat
116+
117+
# Map volumes based on GB
118+
openstack_ratings_hashmap_service_mappings:
119+
- service: storage
120+
cost: 0.16666666666666666
121+
type: flat
122+
123+
See the `OpenStack CloudKitty Ratings role
124+
<https://github.com/stackhpc/ansible-collection-openstack/tree/main/roles/os_ratings>`__
125+
for more details.

doc/source/operations/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This guide is for operators of the StackHPC Kayobe configuration project.
77
.. toctree::
88
:maxdepth: 1
99

10+
cloudkitty
1011
hotfix-playbook
1112
nova-compute-ironic
1213
octavia

0 commit comments

Comments
 (0)