Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Ceilometer installation and API description of OpenStack Monitoring and Measurement Service

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the OpenStack monitoring and measurement service Ceilometer installation and API description of the example analysis, I hope you will learn something after reading this article, let's discuss it together!

What does 1.Ceilometer do?

Ceilometer is a sub-project of OpenStack, which, like a funnel, collects almost all the events that occur within OpenStack, and then provides data support for billing, monitoring and other services. Core architecture diagram of Ceilometer

2.OpenStack Monitoring and Measurement Service Ceilometer installation

2.1 download the latest ceilometer code from github

2.2 install mongodb. Since ceilometer uses mongodb as the default data persistence database, you need to install mongodb first.

Apt-get install mongodb

2.3 add ceilometer users to keystone

Note: the added ceilometer account must belong to admin tenant, otherwise the instance monitoring information cannot be obtained, and this account is added to the ResellerAdmin role to facilitate the acquisition of swift monitoring information. The added ceilometer account needs to belong to admin tenant and the roles are ResellerAdmin and Admin.

View user list

Keystone-os-username admin-os_password pass-os_tenant_name admin-os_auth_url http://localhost:5000/v2.0 user-list

View role list

Keystone-os-username admin-os_password pass-os_tenant_name admin-os_auth_url http://localhost:5000/v2.0 role-list

View tanant list

Keystone-os-username admin-os_password pass-os_tenant_name admin-os_auth_url http://localhost:5000/v2.0 tenant-list

Create a new user

Keystone-os-username admin-os_password pass-os_tenant_name admin-os_auth_url http://localhost:5000/v2.0 user-create-name ceilometer-email co@co.cn-tenant-id tid-pass pass-enabled true

Add user role

Keystone-os-username admin-os_password pass-os_tenant_name admin-os_auth_url http://localhost:5000/v2.0 user-role-add-user-id uid-tenant-id tid-role-id rid

2.4 install ceilometer

1) first check the package on which the module depends

Vim ceilometer/requirements.txt

D2to1 > = 0.2.10 "0.5" 1.2

Kombu

Iso8601

Argparse

SQLAlchemy > = 0.7 ~ 0.7.2

Pymongo > = 2.2

Eventlet

Anyjson > = 0.2.4

Flask==0.9

Pecan > = 0.2.0

Stevedore > = 0.7

Msgpack-python

Python-glanceclient

Python-novaclient > = 2.6.10

Python-keystoneclient > = 0.2.3

Python-swiftclient

Lxml

Requests > = 1.1

Wsme > = 0.5b2

Pyyaml

Oslo.config > = 1.1.0

Happybase > = 0.4

Copy the code

This version of ceilometer uses the newly added oslo.config module in the G version of Openstack to complete the configuration file reading module.

In addition, the WebOb version is required to be more than 1.2. check the F version Openstack using this library version 1.0.8, which is a big conflict, and found that many people reflect that this library is not compatible with the previous library (https://bugs.launchpad.net/ceilometer/+bug/1092227). In my actual installation process, I also found that this library can not be used by python-novaclient, python-glanceclient and other libraries. So I used virtualenv (https://pypi.python.org/pypi/virtualenv) to establish an isolated python environment to install and run ceilometer and related dependencies.

2) install virtualenv and set up isolation sandbox

Sudo pip install virtualenv # installation

Virtualenv grizzlyenv # establish an isolated environment called grizzlyenv

Source grizzlyenv/bin/activate # enters grizzlyenv quarantined environment

After entering, a prompt will appear in front of the prompt, such as

(grizzlyenv) root@ceilotest:/opt#

In this environment, there is a set of environment independent of the global python, where you can use pip and easy_install to install the python package without affecting the global python environment. After using the deactivate command, you can exit to the global environment. The relevant usage can be found on the Internet. I will not repeat it here.

3) after the isolated environment is installed, you can install ceilometer in this environment

# cd ceilometer

# python setup.py develop

After installation, you can see that the dependent packages are installed under the grizzlyenv/lib/python2.7/site-packages/ path.

Copy all the files under ceilometer/etc/ceilometer/ to the / etc/ceilometer/ directory (if not, create a new one), and modify the ceilometer.conf.sample file to:

Ceilometer.conf

[DEFAULT]

Verbose=True

Debug=True

Os_auth_url = http://192.168.5.202:35357/v2.0

Os_tenant_name = admin

Os_password = admin

Os_username = ceilometer

Policy_file = / etc/ceilometer/policy.json

Notification_topics = notifications,glance_notifications

Rabbit_password = admin

Rabbit_host = 127.0.0.1

Rabbit_max_retries = 10

Rpc_backend = ceilometer.openstack.common.rpc.impl_kombu

[keystone_authtoken]

Signing_dir = / etc/ceilometer

Admin_tenant_name = admin

Admin_password = admin

Admin_user = ceilometer

Auth_protocol = http

Copy the code

4) start ceilometer

Open the four tabs in screen and run them one by one:

Ceilometer-collector

Ceilometer-agent-central

Ceilometer-agent-compute

Ceilometer-api

Corresponding to the four important modules in the ceilometer architecture, the problem of No module named libvirt may occur during the startup of ceilometer-agent-compute. This is because python-libvirt is not installed in the isolated environment, but it is also found that the library cannot be installed using pip. However, using the dpkg-l command to check, it is found that python-libvirt has indeed been installed. So copy the relevant files in the global environment directly to the quarantined environment and modify the appropriate permissions:

Cp / usr/lib/python2.7/dist-packages/libvirt* / opt/stack/grizzlyenv/lib/python2.7/site-packages/

Chown stack:stack / opt/stack/grizzlyenv/lib/python2.7/site-packages/libvirt*

This should start normally, and after startup, you can view the corresponding data records in mongodb.

3.OpenStack Monitoring and Measurement Service Ceilometer API description

3.API

3.1 Resources Resources

Get information about the resource.

GET http://HOST:8777/v2/resources

Lists the definitions of all resources.

GET http://HOST:8777/v2/resources/{resource_id}

Gets the details of the specified resource.

3.2 Meters Metrology

Get measurement information.

GET http://HOST:8777/v2/meters

List of measurement data so far.

GET http://HOST:8777/v2/meters/{meter_id}

Gets the metering information for the specified ID.

POST http://HOST:8777/v2/meters/{meter_id}

Updates the list of measurement information for the specified ID.

GET http://HOST:8777/v2/meters/{meter_id}/statistics

Calculates statistics for samples within the specified time range.

3.3 Alarms alarm

List, create, get details, update and delete alarms.

GET http://HOST:8777/v2/alarms

Alerts are listed based on the specified query.

POST http://HOST:8777/v2/alarms

Create an alarm.

GET http://HOST:8777/v2/alarms/{alarm_id}

Gets the alarm information for the specified ID.

PUT http://HOST:8777/v2/alarms/{alarm_id}

Updates the alarm for the specified ID.

PUT http://HOST:8777/v2/alarms/{alarm_id}/state

Sets the alarm status of a specified ID.

GET http://HOST:8777/v2/alarms/{alarm_id}/state

Gets the alarm status of the specified ID.

GET http://HOST:8777/v2/alarms/{alarm_id}/history

Assembles the alarm history of the specified ID.

After reading this article, I believe you have some understanding of "sample Analysis of Ceilometer installation and API description of OpenStack Monitoring and Measurement Service". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report