Here is the document I refer to
Configure the/etc/ceilometer/pipeline.yaml, add the following
sources:
- name: memory_util_source
meters:
- "memory"
- "memory.usage"
sinks:
- memory_util_sink
sinks:
- name: memory_util_sink
transformers:
- name: "arithmetic"
parameters:
target:
name: "memory.usage"
unit: "%"
type: "gauge"
expr: "100 * $(memory.usage) / $(memory)"
publishers:
- gnocchi://?filter_project=service&archive_policy=ceilometer-low
gnocchi archive-policy show ceilometer-low
+---------------------+------------------------------------------------------------------+
| Field | Value |
+---------------------+------------------------------------------------------------------+
| aggregation_methods | max, min, mean |
| back_window | 0 |
| definition | - points: 8640, granularity: 0:05:00, timespan: 30 days, 0:00:00 |
| name | ceilometer-low |
+---------------------+------------------------------------------------------------------+
Gnocchi resource memory usage metric measures interval granularity is per hour. There is only one data granularity every five minutes, why is there such a strange phenomenon.
I tried a workaround to get the memory utilization of the instance, the steps are as follows.
(1)Add the following code to the /ceilometer/compute/pollsters/instance_stats.py file.
(2)Modify the logic code for calculating instance memory usage in the /ceilometer/compute/virt/libvirt/inspector.py file
(3)Add the memory_util attribute of the InstanceStats object in the /ceilometer/compute/virt/inspector.py file
(4)Add the memory_util plugin under ceilometer.poll.compute in the setup.cfg file
(5)Package, compile and install ceilometer, the reference link for the package compilation process is as follows. openstack-ceilometer-11.0.1-1.el7.src.rpm can be found here
(6)Add the following configuration to the /etc/ceilometer/gnocchi_resources.yaml file.
(7)Add the following configuration to the /etc/ceilometer/polling.yaml file.
(8)Add the following configuration to the /etc/ceilometer/pipeline.yaml file.
(9)Finally, restart the openstack-ceilometer-compute service