Openstack Ceilometer is primarily used to monitor virtual machines, services (glance, image, network, and so on) and events. The monitoring items of the virtual machine mainly include CPU, disk, network, instance. Based on the existing monitoring items, this paper introduces how to add new monitoring items.
First, Ceilometer frame structure
Ceilometer monitoring through the deployment of compute services in compute nodes, polling their compute nodes instance, to obtain their own CPU, network, disk and other monitoring information, sent to the Rabbitmq,collector service is responsible for receiving information for persistent storage, The detailed framework is shown ( Click to view larger image ).
This paper mainly introduces the monitoring of instance, obtains the monitoring data of instance to send to the message queue. Instance monitoring data acquisition mainly through the compute service in pollster way to poll the virtual machine, compute service class diagram as follows ( Click to view the larger image ).
This class diagram shows that the new project needs to inherit the Computepollster class and implement the Get_samples method. Finally, it can be configured to obtain new monitoring item data. As the existing ceilometer does not have real-time monitoring of memory, this article takes memory as an example and details the process of adding new monitoring items.
second, new virtual machine monitoring items
Existing virtual machine monitoring project, no memory monitoring. Taking memory as an example, this paper introduces the method of adding memory monitor module, and it is simpler to increase the memory monitoring method, mainly to increase the way of acquiring data on the compute side, and then modify the configuration file to persist the data in the database. The detailed steps are as follows:
1. Create a new file mem.py (name customization) under the Ceilometer/ceilometer/compute/pollsters directory. Define the Mempollster class under this file and implement the Get_samples method:
Class Mempollster (Plugin.computepollster): |
def get_samples (self, manager, cache, instance): |
2, Get_samples in the way to obtain memory data, you can refer to the CPU to obtain the data of the schema, in ceilometer/ceilometer/compute/virt/inspector.py to define the format of the return data:
Memstats = collections.namedtuple (' memstats ', [' total ', ' free ']) |
Get memory mode, this article uses read proc file to get the memory size occupied by instance process, sometimes get more data than instance maximum memory, so this way to the Windows system virtual machine has a certain error, only as an example reference. The method is defined as follows:
def inspect_mems (self, instance_name): |
Once the data has been obtained, it can be returned by the sample data structure.
3, after the design of the above data acquisition method, and can not poll the memory data, but also need to modify some settings files.
First, modify the Ceilometer/setup.cfg file, under the file Ceilometer.poll.compute, to add
MEM = Ceilometer.compute.pollsters.mem:MEMPollster |
Second, because of packet conflict, the Ceilometer is installed in an isolated environment, so the source isolated environment, reinstall Ceilometer, the above configuration to take effect. Execute the Python setup.py develop command.
4. Restart the Ceilometer service and enter the MongoDB Ceilometer database to view the MEM monitoring data in the meter table.
Some implementations of monitoring can be done: https://github.com/kevinjs/procagent
http://blog.csdn.net/dysj4099/article/details/18255393
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
< turn >openstack ceilometer monitoring Item extension