For a cloud environment, not only can we virtualize the relevant virtual machines, we also need to detect information about the relevant virtual machine objects, such as CPU, memory, IO, and so on, so OpenStack has a ceilometer component that can help us get this information.
Measurement (metering): Ceilometer. Like a funnel, it collects almost all the events that occur within the OpenStack, and then provides data support for billing and monitoring and other services. Integrated into the project from the Havana version. Ceilometer as the largest consumer of OpenStack internal notification, some events within OpenStack emit corresponding notification messages, such as the creation and deletion of instance, which are measured/ Billing important information, so the first way is ceilometer first data source, but some measurement information through notification message is not get, such as instance CPU running time, or CPU usage, This information is not sent through notification messages, so Ceilometer adds a second way to periodically invoke the relevant APIs to get the information.
Let me first explain how to install the Ceilometer component
First, do the following on the control node (192.168.3.180)
1. Installation Components
sudo aptitude install Ceilometer-api ceilometer-collector ceilometer-agent-central ceilometer-agent-notification Ceilometer-alarm-evaluator Ceilometer-alarm-notifier python-ceilometerclient
2. Installation MongoDB
Unlike other components that are installed in MySQL, the Ceilometer component stores data in MongoDB, which individuals think might be relatively large and require real-time access, and mongodb efficiency is better than MySQL.
sudo apt-get install Mongodb-server
3, edit the MongoDB configuration file
sudo vi/etc/mongodb.conf
Update server IP information: bind_ip = 192.168.3.180
4. Restart MongoDB Service
sudo service MongoDB restart
5. Create DATABASE and Ceilometer database users
Library Name: Ceilometer
Account: Ceilometerdbadmin
Password: ceilometer4smtest
sudo mongo--host 192.168.3.180--eval '
db = Db.getsiblingdb ("Ceilometer");
Db.adduser ({User: "Ceilometerdbadmin",
PWD: "Ceilometer4smtest",
roles: ["ReadWrite", "Dbadmin"]}) '
sm@controller:~$ sudo mongo--host 192.168.3.180--eval '
> db = Db.getsiblingdb ("Ceilometer");
> Db.adduser ({User: "Ceilometerdbadmin",
> pwd: "ceilometer4smtest",
> Roles: ["ReadWrite", "dbadmin ']} '
MongoDB shell version:2.4.9
connecting to:192.168.3.180:27017/test
{
' user ': ' Ceilometerdbadmin ",
" pwd ":" 693449936c0cdcf9d0da2d3c2246122d ",
" roles ": [
" ReadWrite ",
" Dbadmin "
],
" _id ": ObjectId (" 55419f02f1437115033e6bb6 ")
}
6, Configuration database information
sudo vi/etc/ceilometer/ceilometer.conf
[Database]
# The SQLAlchemy connection string used to connect to the
# Database (string value)
connection = Mongodb://ceilo Meterdbadmin:ceilometer4smtest@192.168.3.180:27017/ceilometer
7. Define a key
sudo OpenSSL Rand-hex 10
sm@controller:~$ sudo openssl rand-hex
80f7bb8ca173a3fd8fab
sudo vi/etc/ceilometer/ceilometer.conf
[Publisher]
# Secret value for signing metering messages (string value)
Metering_secret = 80f7bb8ca173a3fd8fab
8. Configure Message information
sudo vi/etc/ceilometer/ceilometer.conf
[DEFAULT]
Rpc_backend = Ceilometer.openstack.common.rpc.impl_kombu
rabbit_host = 192.168.3.180
rabbit_port = 5672
Rabbit_userid = Guest
Rabbit_password = mq4smtest
9, Configuration Log directory
sudo vi/etc/ceilometer/ceilometer.conf
[DEFAULT]
Log_dir =/var/log/ceilometer
10. Keystone Create Ceilometer service users and roles
Keystone User-create--name=ceilometer--pass=ceilometer4smtest--email=sm@163.com
sm@controller:~$ Keystone User-create--name=ceilometer--pass=ceilometer4smtest--email=sm@163.com
+---------- +----------------------------------+
| Property | Value |
+----------+----------------------------------+
| Email | sm@163.com |
| True |
| ID | 4fd9cbdca36f414590adf65cfe343743 |
| Name | Ceilometer |
| username | Ceilometer |
+----------+----------------------------------+
Keystone User-role-add--user=ceilometer--tenant=service--role=admin
11, update the Keystone information of the configuration file
sudo vi/etc/ceilometer/ceilometer.conf
[DEFAULT]
Auth_strategy = Keystone
[Keystone_authtoken]
Auth_uri = http://192.168.3.180:5000 auth_host
= 192.168.3.180
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
Admin_user = Ceilometer
Admin_password = ceilometer4smtest
Add the following section
[Service_credentials]
Os_auth_url = http://192.168.3.180:5000/v2.0
os_username = ceilometer
os_tenant_name = Service
Os_ Password = ceilometer4smtest
12. Create service
Keystone Service-create--name=ceilometer--type=metering \
--description= "Telemetry"
sm@controller:~$ Keystone Service-create--name=ceilometer--type=metering \
>--description= "Telemetry"
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | Telemetry |
| Enabled | True |
| ID | 8add6525e59c4c4cb62b04065dd0f353 |
| Name | Ceilometer |
| Type | Metering |
+-------------+----------------------------------+
Keystone endpoint-create \
--service-id=$ (Keystone Service-list | awk '/metering/{print $} ') \
--publicurl=http://192.168.3.180:8777 \
--internalurl=http://192.168.3.180:8777 \
--adminurl=http://192.168.3.180:8777
sm@controller:~$ Keystone Endpoint-create
>--service-id=$ (Keystone service-list | awk '/metering/{print $} ') \
>--publicurl=http://192.168.3.180:8777
>--internalurl=http://192.168.3.180:8777
>- adminurl=http://192.168.3.180:8777
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| Adminurl | http://192.168.3.180:8777 |
| ID | 31f58a6be962408bbd280cf2b5dd747c |
| InternalUrl | http://192.168.3.180:8777 |
| Publicurl | http://192.168.3.180:8777 |
| Region | Regionone |
| service_id | 8add6525e59c4c4cb62b04065dd0f353 |
+-------------+----------------------------------+
13. Restart Service
sudo service ceilometer-agent-central restart
sudo service ceilometer-agent-notification restart
sudo service Ceilometer-api restart
sudo service ceilometer-collector restart
sudo service ceilometer-alarm-evaluator restart
sudo service ceilometer-alarm-notifier restart
Second, all compute nodes, do the following installation
1, sudo apt-get install Ceilometer-agent-compute
2, sudo vi/etc/nova/nova.conf
[DEFAULT]
Instance_usage_audit = True
instance_usage_audit_period = Hour
Notify_on_state_change = vm_and_task_state
notification_driver = nova.openstack.common.notifier.rpc_notifier
notification_driver = Ceilometer.compute.nova_notifier
3, Restart Computing services
sudo service nova-compute restart
4. Define a key
If the control node and the compute node are a physical machine, the key does not need to be regenerated, and if not, the compute node needs to be regenerated.
sudo OpenSSL Rand-hex 10
sm@controller:~$ sudo openssl rand-hex
80f7bb8ca173a3fd8fab
sudo vi/etc/ceilometer/ceilometer.conf
[Publisher]
# Secret value for signing metering messages (string value)
Metering_secret = 80f7bb8ca173a3fd8fab
5. Configure Message information
sudo vi/etc/ceilometer/ceilometer.conf
[DEFAULT]
Rpc_backend = Ceilometer.openstack.common.rpc.impl_kombu
rabbit_host = 192.168.3.180
rabbit_port = 5672
Rabbit_userid = Guest
Rabbit_password = mq4smtest
6, update the Keystone information of the configuration file
sudo vi/etc/ceilometer/ceilometer.conf
[DEFAULT]
Auth_strategy = Keystone
[Keystone_authtoken]
Auth_uri = http://192.168.3.180:5000 auth_host
= 192.168.3.180
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
Admin_user = Ceilometer
Admin_password = ceilometer4smtest
Add the following section
[Service_credentials]
Os_auth_url = http://192.168.3.180:5000/v2.0
os_username = ceilometer
os_tenant_name = Service
Os_ Password = ceilometer4smtest
7, Configuration Log directory
sudo vi/etc/ceilometer/ceilometer.conf
[DEFAULT]
Log_dir =/var/log/ceilometer
8. Restart Service
sudo service ceilometer-agent-compute restart
Third, the control node for mirroring service configuration
1, sudo vi/etc/glance/glance-api.conf
[DEFAULT]
Notification_driver = Messaging
rpc_backend = Rabbit rabbit_host = 192.168.3.180 Rabbit_password
= Mq4smtest
2. Restart Service
sudo service glance-registry restart
sudo service Glance-api restart
Four, block service configuration (which node has a block service on which node configuration)
1, sudo vi/etc/cinder/cinder.conf
[DEFAULT]
Control_exchange = Cinder
notification_driver = Cinder.openstack.common.notifier.rpc_notifier
2. Restart Service
sudo service Cinder-api restart
sudo service Cinder-scheduler restart
sudo service cinder-volume restart
V. Verifying installation
1. View meter List
Ceilometer meter-list
sm@controller:~$ Ceilometer meter-list +--------------------------+------------+-----------+--------------------- -----------------
+----------------------------------+----------------------------------+
| Name | Type | Unit | Resource ID | User ID |
Project ID | +--------------------------+------------+-----------+--------------------------------------
+------------------- ---------------+----------------------------------+
| CPU | Cumulative | NS |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 | | Cpu_util | Gauge | % |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 | | Disk.read.bytes | Cumulative | B |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c |b500268a41e34752aba847c7ea464870 | | Disk.read.bytes.rate | Gauge | b/S |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 | | disk.read.requests | Cumulative | Request |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 | | Disk.read.requests.rate | Gauge | request/s |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 | | Disk.write.bytes | Cumulative | B |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 | | Disk.write.bytes.rate | Gauge | b/S |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 | | disk.write.requests | Cumulative | Request |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | B500268a41e34752aba847c7ea464870 | | Disk.write.requests.rate | Gauge | request/s |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 | | Image | Gauge | Image | f2b0f15b-bd5e-4766-973c-24547c1faf03 | None | b500268a41e34752aba847c7ea464870 | | Image.size | Gauge | B | f2b0f15b-bd5e-4766-973c-24547c1faf03 | None | b500268a41e34752aba847c7ea464870 | | instance | Gauge | instance |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 | | Instance:m1.tiny | Gauge | instance |
8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 9b1cdfc2b5614eb39f042317f54a286c |
b500268a41e34752aba847c7ea464870 | +--------------------------+------------+-----------+--------------------------------------
+------------------- ---------------+----------------------------------+
2. Download Mirror Service
Glance image-download "cirros-0.3.2-x86_64" > Cirros.img
See Ceilometer Meter-list again
3. Access to statistical information
Ceilometer statistics-m image.download-p 60
Five, in the horzion inside view
We can see that the admin item has added a resource usage that includes daily and statistical data
Daily
Statistical data