OpenStack Train版 简单部署流程(3)- ceilometer
ceilometer
openstack project create --domain default --description "Service Project" service yum -y install redis libvirt epel-release yum -y install python-pip python-devel sed -i 's/^bind 127.0.0.1/bind 0.0.0.0/g' /etc/redis.conf sed -i 's/^protected-mode yes/protected-mode no/g' /etc/redis.conf sed -i 's/^daemonize no/daemonize yes/g' /etc/redis.conf systemctl enable redis libvirtd;systemctl restart redis libvirtd;systemctl status redis libvirtd pip install uwsgi
cat << EOF >> /etc/httpd/conf.d/wsgi-ceilometer.conf
Listen 8777
<VirtualHost *:8777>
WSGIDaemonProcess ceilometer-api processes=2 threads=10 user=ceilometer group=ceilometer display-name=%{GROUP}
WSGIProcessGroup ceilometer-api
WSGIScriptAlias / "/var/www/cgi-bin/ceilometer/app"
WSGIApplicationGroup %{GLOBAL}
ErrorLog /var/log/httpd/ceilometer_error.log
CustomLog /var/log/httpd/ceilometer_access.log combined
</VirtualHost>
WSGISocketPrefix /var/run/httpd
EOF
controller node
mysql -u root -p1234qwer CREATE DATABASE gnocchi; GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'localhost' IDENTIFIED BY 'gnocchi'; GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'%' IDENTIFIED BY 'gnocchi'; quit . /root/admin-openrc openstack user create --domain default --password ceilometer123 ceilometer openstack role add --project service --user ceilometer admin openstack user create --domain default --password gnocchi123 gnocchi openstack service create --name gnocchi --description "Metric Service" metric openstack role add --project service --user gnocchi admin openstack endpoint create --region RegionOne metric public http://controller:8041 openstack endpoint create --region RegionOne metric internal http://controller:8041 openstack endpoint create --region RegionOne metric admin http://controller:8041
yum -y install openstack-gnocchi-api openstack-gnocchi-metricd python-gnocchiclient openstack-config --set /etc/gnocchi/gnocchi.conf api auth_mode keystone openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken auth_type password openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken auth_url http://controller:5000/v3 openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken project_domain_name default openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken user_domain_name default openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken project_name service openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken username gnocchi openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken password gnocchi123 openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken interface internalURL openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken region_name RegionOne openstack-config --set /etc/gnocchi/gnocchi.conf indexer url mysql+pymysql://gnocchi:gnocchi@controller/gnocchi openstack-config --set /etc/gnocchi/gnocchi.conf storage coordination_url redis://controller:6379 openstack-config --set /etc/gnocchi/gnocchi.conf storage file_basepath /var/lib/gnocchi openstack-config --set /etc/gnocchi/gnocchi.conf storage driver file chown -R gnocchi:gnocchi /var/lib/gnocchi
gnocchi-upgrade systemctl enable openstack-gnocchi-api.service openstack-gnocchi-metricd.service
systemctl restart openstack-gnocchi-api.service openstack-gnocchi-metricd.service systemctl status openstack-gnocchi-api.service openstack-gnocchi-metricd.service
yum -y install openstack-ceilometer-notification openstack-ceilometer-central vim /etc/ceilometer/pipeline.yaml publishers: # set address of Gnocchi # + filter out Gnocchi-related activity meters (Swift driver) # + set default archive policy - gnocchi://?filter_project=service&archive_policy=low openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT transport_url rabbit://openstack:RABBIT_PASS@controller openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials auth_type password openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials auth_url http://controller:5000/v3 openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials project_domain_id default openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials user_domain_id default openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials project_name service openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials username ceilometer openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials password ceilometer123 openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials interface internalURL openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials region_name RegionOne ceilometer-upgrade systemctl enable openstack-ceilometer-notification.service openstack-ceilometer-central.service
systemctl restart openstack-ceilometer-notification.service openstack-ceilometer-central.service systemctl status openstack-ceilometer-notification.service openstack-ceilometer-central.service
启用服务测量
##glance openstack-config --set /etc/glance/glance-api.conf DEFAULT transport_url rabbit://openstack:RABBIT_PASS@controller openstack-config --set /etc/glance/glance-api.conf oslo_messaging_notifications driver messagingv2 openstack-config --set /etc/glance/glance-registry.conf DEFAULT transport_url rabbit://openstack:RABBIT_PASS@controller openstack-config --set /etc/glance/glance-registry.conf oslo_messaging_notifications driver messagingv2 systemctl restart openstack-glance-api.service openstack-glance-registry.service ##neutron openstack-config --set /etc/neutron/neutron.conf oslo_messaging_notifications driver messagingv2 systemctl restart neutron-server.service
compute node
yum -y install openstack-ceilometer-compute openstack-ceilometer-ipmi openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT transport_url rabbit://openstack:RABBIT_PASS@controller openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials auth_type password openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials auth_url http://controller:5000/v3 openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials project_domain_id default openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials user_domain_id default openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials project_name service openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials username ceilometer openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials password ceilometer123 openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials interface internalURL openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials region_name RegionOne openstack-config --set /etc/nova/nova.conf DEFAULT instance_usage_audit True openstack-config --set /etc/nova/nova.conf DEFAULT instance_usage_audit_period hour openstack-config --set /etc/nova/nova.conf notifications notify_on_state_change vm_and_task_state openstack-config --set /etc/nova/nova.conf oslo_messaging_notifications driver messagingv2 vim /etc/sudoers ceilometer ALL = (root) NOPASSWD: /usr/bin/ceilometer-rootwrap /etc/ceilometer/rootwrap.conf * vim /etc/ceilometer/polling.yaml - name: ipmi interval: 300 meters: - hardware.ipmi.temperature systemctl enable openstack-ceilometer-compute.service openstack-ceilometer-ipmi.service
systemctl restart openstack-ceilometer-compute.service openstack-ceilometer-ipmi.service openstack-nova-compute.service systemctl status openstack-ceilometer-compute.service openstack-ceilometer-ipmi.service openstack-nova-compute.service
echo 'export OS_AUTH_TYPE=password' >>/root/admin-openrc
ceilometer查看数据
##查看监控项目
gnocchi metric list [root@controller ceilometer]# gnocchi metric list |grep memory|grep 18722 | 5869bc9f-0642-480a-ba1e-dfd40891d7d3 | low | memory.usage | MB | 18722e9f-0a30-41eb-b388-65b4c8aadff2 | | f6a18693-daad-49d7-aaf8-79d0e66ed892 | low | memory | MB | 18722e9f-0a30-41eb-b388-65b4c8aadff2 |
##查看具体监控数据
[root@controller ceilometer]# gnocchi measures show 5869bc9f-0642-480a-ba1e-dfd40891d7d3 +---------------------------+-------------+-------+ | timestamp | granularity | value | +---------------------------+-------------+-------+ | 2020-07-24T10:50:00+08:00 | 300.0 | 200.0 | +---------------------------+-------------+-------+
##在计算节点修改监控项
vim /etc/ceilometer/polling.yaml
sources: - name: some_pollsters interval: 5 meters: - cpu - cpu_l3_cache - perf.cpu.cycles - memory.usage - network.incoming.bytes - network.incoming.packets - network.outgoing.bytes - network.outgoing.packets - disk.device.read.bytes - disk.device.read.requests - disk.device.write.bytes - disk.device.write.requests - hardware.cpu.util - hardware.cpu.user - hardware.cpu.nice - hardware.cpu.system - hardware.cpu.idle - hardware.cpu.wait ... ...
systemctl restart openstack-ceilometer-compute.service openstack-ceilometer-ipmi.service openstack-nova-compute.service
systemctl status openstack-ceilometer-compute.service openstack-ceilometer-ipmi.service openstack-nova-compute.service