### Install uWSGI packages Source: https://docs.openstack.org/ceilometer/latest/install/install-base-ubuntu.html Installs the uWSGI Python 3 plugin and the uWSGI server using apt-get. ```bash # apt-get install uwsgi-plugin-python3 uwsgi ``` -------------------------------- ### Install Ceilometer packages Source: https://docs.openstack.org/ceilometer/latest/install/install-base-ubuntu.html Installs the Ceilometer agent for notifications and the central agent using apt-get. ```bash # apt-get install ceilometer-agent-notification \ ceilometer-agent-central ``` -------------------------------- ### Install Gnocchi packages Source: https://docs.openstack.org/ceilometer/latest/install/install-base-ubuntu.html Installs the Gnocchi API, metric daemon, and client using apt-get. ```bash # apt-get install gnocchi-api gnocchi-metricd python3-gnocchiclient ``` -------------------------------- ### Start and enable Ceilometer services Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Enables and starts the Ceilometer notification and central services. ```bash # systemctl enable openstack-ceilometer-notification.service \ openstack-ceilometer-central.service ``` -------------------------------- ### Start Ceilometer Services Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Command to start the OpenStack Ceilometer notification and central services. ```bash systemctl start openstack-ceilometer-notification.service \ openstack-ceilometer-central.service ``` -------------------------------- ### Start and enable Gnocchi services Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Enables and starts the Gnocchi API and metricd services. ```bash # systemctl enable gnocchi-api.service gnocchi-metricd.service # systemctl start gnocchi-api.service gnocchi-metricd.service ``` -------------------------------- ### Install tox Source: https://docs.openstack.org/ceilometer/latest/contributor/testing.html Installs the tox package, a tool for automating testing. ```bash $ sudo pip install tox ``` -------------------------------- ### Example for multi-page host commands Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html This example shows how to execute multi-page host commands using next_sample_url_attribute. ```yaml --- - name: "dynamic.s3.objects.size" sample_type: "gauge" unit: "request" value_attribute: "Size" project_id_attribute: "Owner.ID" user_id_attribute: "Owner.ID" resource_id_attribute: "Key" response_entries_key: "Contents" host_command: "aws s3api list-objects" next_sample_url_attribute: NextToken | 'aws s3api list-objects --starting-token "' + value + '"' ``` -------------------------------- ### Start and enable services Source: https://docs.openstack.org/ceilometer/latest/install/install-compute-rdo.html Start the agent and configure it to start when the system boots. ```bash # systemctl enable openstack-ceilometer-compute.service # systemctl start openstack-ceilometer-compute.service # systemctl enable openstack-ceilometer-ipmi.service (optional) # systemctl start openstack-ceilometer-ipmi.service (optional) ``` -------------------------------- ### Example of using local host command Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html This example illustrates how to use the local host command for dynamic polling. ```yaml --- - name: "dynamic.host.command" sample_type: "gauge" unit: "request" value_attribute: "value" response_entries_key: "test" host_command: "echo 'id1_uid1_pid1meta-data-to-store1'" metadata_fields: - "meta" response_handlers: - xml ``` -------------------------------- ### Boot command with custom metadata Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-measurements.html Example of specifying custom metadata when booting a new instance. ```bash $ openstack server create --property metering.custom_metadata=a_value my_vm ``` -------------------------------- ### Install the packages Source: https://docs.openstack.org/ceilometer/latest/install/install-compute-rdo.html Install the necessary packages for Ceilometer compute services. ```bash # dnf install openstack-ceilometer-compute # dnf install openstack-ceilometer-ipmi (optional) ``` -------------------------------- ### Install Ceilometer packages Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Installs the Ceilometer notification and central packages. ```bash # dnf install openstack-ceilometer-notification \ openstack-ceilometer-central ``` -------------------------------- ### Install uWSGI packages Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Installs the necessary uWSGI packages for Gnocchi API. ```bash # dnf install uwsgi-plugin-common uwsgi-plugin-python3 uwsgi ``` -------------------------------- ### Install Gnocchi packages Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Installs the Gnocchi API, metric daemon, and client using dnf. ```bash # dnf install gnocchi-api gnocchi-metricd python3-gnocchiclient ``` -------------------------------- ### Example headers configuration Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html This snippet shows an example of how to configure custom headers for dynamic pollster requests. ```yaml headers: "x-openstack-nova-api-version": "2.46" ``` -------------------------------- ### Install packages Source: https://docs.openstack.org/ceilometer/latest/install/install-compute-ubuntu.html Installs the necessary packages for the Compute agent and optionally the IPMI agent. ```bash # apt-get install ceilometer-agent-compute # apt-get install ceilometer-agent-ipmi (optional) ``` -------------------------------- ### Dynamic Pollster Configuration Example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html An example configuration for a dynamic pollster to gather VM status and enrich it with project name, domain ID, and domain name from Keystone. ```yaml --- - name: "dynamic_pollster.instance.status" next_sample_url_attribute: "server_links | filter(lambda v: v.get('rel') == 'next', value) | list(value) | value[0] | value.get('href') | value.replace('http:', 'https:')" sample_type: "gauge" unit: "server" value_attribute: "status" endpoint_type: "compute" url_path: "/v2.1/servers/detail?all_tenants=true" headers: "Openstack-API-Version": "compute 2.65" project_id_attribute: "tenant_id" metadata_fields: - "status" - "name" - "flavor.vcpus" - "flavor.ram" - "flavor.disk" - "flavor.ephemeral" - "flavor.swap" - "flavor.original_name" - "image | value or { 'id': '' } | value['id']" - "OS-EXT-AZ:availability_zone" - "OS-EXT-SRV-ATTR:host" - "user_id" - "tags | ','.join(value)" - "locked" value_mapping: ACTIVE: "1" default_value: 0 metadata_mapping: "OS-EXT-AZ:availability_zone": "dynamic_availability_zone" "OS-EXT-SRV-ATTR:host": "dynamic_host" "flavor.original_name": "dynamic_flavor_name" "flavor.vcpus": "dynamic_flavor_vcpus" "flavor.ram": "dynamic_flavor_ram" "flavor.disk": "dynamic_flavor_disk" "flavor.ephemeral": "dynamic_flavor_ephemeral" "flavor.swap": "dynamic_flavor_swap" "image | value or { 'id': '' } | value['id']": "dynamic_image_ref" "name": "dynamic_display_name" "locked": "dynamic_locked" "tags | ','.join(value)": "dynamic_tags" extra_metadata_fields_cache_seconds: 3600 extra_metadata_fields_skip: - value: '1' metadata: dynamic_flavor_vcpus: 4 - value: '1' metadata: dynamic_flavor_vcpus: 2 extra_metadata_fields: - name: "project_name" endpoint_type: "identity" url_path: "'/v3/projects/' + str(sample['project_id'])" headers: "Openstack-API-Version": "identity latest" value: "name" extra_metadata_fields_cache_seconds: 1800 # overriding the default cache policy metadata_fields: - id - name: "domain_id" endpoint_type: "identity" url_path: "'/v3/projects/' + str(sample['project_id'])" headers: "Openstack-API-Version": "identity latest" value: "domain_id" metadata_fields: - id - name: "domain_name" endpoint_type: "identity" url_path: "'/v3/domains/' + str(extra_metadata_captured['domain_id'])" headers: "Openstack-API-Version": "identity latest" value: "name" metadata_fields: - id - name: "operating-system" host_command: "'get-vm --vm-name ' + str(extra_metadata_by_name['project_name']['metadata']['id'])" value: "os" ``` -------------------------------- ### Install python-ceilometermiddleware package Source: https://docs.openstack.org/ceilometer/latest/install/swift/install-swift-ubuntu.html Install the necessary Python package for Ceilometer middleware. ```bash # apt-get install python-ceilometermiddleware ``` -------------------------------- ### Value Mapping Example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html Example of how to define value_mapping for a dynamic pollster. ```yaml value_mapping: CREATE_IN_PROGRESS: "0" CREATE_FAILED: "1" CREATE_COMPLETE: "2" UPDATE_IN_PROGRESS: "3" UPDATE_FAILED: "4" UPDATE_COMPLETE: "5" DELETE_IN_PROGRESS: "6" DELETE_FAILED: "7" DELETE_COMPLETE: "8" RESUME_COMPLETE: "9" RESUME_FAILED: "10" RESTORE_COMPLETE: "11" ROLLBACK_IN_PROGRESS: "12" ROLLBACK_FAILED: "13" ROLLBACK_COMPLETE: "14" SNAPSHOT_COMPLETE: "15" CHECK_COMPLETE: "16" ADOPT_COMPLETE: "17" ``` -------------------------------- ### Metadata Mapping Example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html Example of how to define metadata_mapping for a dynamic pollster. ```yaml metadata_mapping: name: "display_name" some_attribute: "new_attribute_name" ``` -------------------------------- ### Initialize Gnocchi Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Runs the Gnocchi database upgrade command. ```bash gnocchi-upgrade ``` -------------------------------- ### Install python3-ceilometermiddleware package Source: https://docs.openstack.org/ceilometer/latest/install/swift/install-swift-rdo.html Install the necessary Python package for Ceilometer middleware. ```bash # dnf install python3-ceilometermiddleware ``` -------------------------------- ### Example configuration for gathering VPN connections data Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html This example shows how to configure a dynamic pollster to gather data for VPN connections, including status mapping. ```yaml --- - name: "dynamic.network.services.vpn.connection" sample_type: "gauge" unit: "ipsec_site_connection" value_attribute: "status" endpoint_type: "network" url_path: "v2.0/vpn/ipsec-site-connections" metadata_fields: - "name" - "vpnservice_id" - "description" - "status" - "peer_address" value_mapping: ACTIVE: "1" metadata_mapping: name: "display_name" default_value: 0 ``` -------------------------------- ### Create ceilometer user Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Creates the 'ceilometer' user with a password prompt. ```bash $ openstack user create --domain default --password-prompt ceilometer User Password: Repeat User Password: +-----------+----------------------------------+ | Field | Value | +-----------+----------------------------------+ | domain_id | e0353a670a9e496da891347c589539e9 | | enabled | True | | id | c859c96f57bd4989a8ea1a0b1d8ff7cd | | name | ceilometer | +-----------+----------------------------------+ ``` -------------------------------- ### Example Event Definitions File Source: https://docs.openstack.org/ceilometer/latest/contributor/events.html A YAML example demonstrating the structure of an event definitions file, including event types, traits, and plugin configurations. ```yaml --- - event_type: compute.instance.* traits: &instance_traits user_id: fields: payload.user_id instance_id: fields: payload.instance_id host: fields: publisher_id plugin: name: split parameters: segment: 1 max_split: 1 service_name: fields: publisher_id plugin: split instance_type_id: type: int fields: payload.instance_type_id os_architecture: fields: payload.image_meta.'org.openstack__1__architecture' launched_at: type: datetime fields: payload.launched_at deleted_at: type: datetime fields: payload.deleted_at - event_type: - compute.instance.exists - compute.instance.update traits: <<: *instance_traits audit_period_beginning: type: datetime fields: payload.audit_period_beginning audit_period_ending: type: datetime fields: payload.audit_period_ending ``` -------------------------------- ### Restart Ceilometer services Source: https://docs.openstack.org/ceilometer/latest/install/install-base-ubuntu.html Restarts the Ceilometer central agent and notification agent services. ```bash # systemctl restart ceilometer-agent-central # systemctl restart ceilometer-agent-notification ``` -------------------------------- ### Text Response Handler Example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html Configuration snippet showing the 'text' response handler and example responses. ```yaml --- - name: "dynamic.json.response" sample_type: "gauge" [...] response_handlers: - text ``` ```text Plain text response ``` ```json { "out": "Plain text response" } ``` -------------------------------- ### XML Response Handler Example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html Configuration snippet showing the 'xml' response handler and example responses. ```yaml --- - name: "dynamic.json.response" sample_type: "gauge" [...] response_handlers: - xml ``` ```xml 1 2 3 ``` ```json { "test": { "list": [1, 2, 3] } } ``` -------------------------------- ### Restart Gnocchi services Source: https://docs.openstack.org/ceilometer/latest/install/install-base-ubuntu.html Restarts the Apache web server and the Gnocchi metric daemon services. ```bash # systemctl restart apache2 # systemctl restart gnocchi-metricd ``` -------------------------------- ### Example of dynamic pollster for successful_ops Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html This example demonstrates how to gather the successful_ops variable instead of the total .ops variable. ```yaml --- - name: "dynamic.radosgw.api.request.successful_ops" sample_type: "gauge" unit: "request" value_attribute: "total.successful_ops" url_path: "http://rgw.service.stage.i.ewcs.ch/admin/usage" module: "awsauth" authentication_object: "S3Auth" authentication_parameters: ", ," user_id_attribute: "user" project_id_attribute: "user" resource_id_attribute: "user" response_entries_key: "summary" ``` -------------------------------- ### Create Gnocchi database Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Creates the 'gnocchi' database in MySQL. ```sql CREATE DATABASE gnocchi; ``` -------------------------------- ### Enable the Ceilometer devstack plugin Source: https://docs.openstack.org/ceilometer/latest/contributor/devstack.html To enable the Ceilometer devstack plugin, add this to local.conf. ```bash # Enable the Ceilometer devstack plugin enable_plugin ceilometer https://opendev.org/openstack/ceilometer.git ``` -------------------------------- ### Create ceilometer service entity Source: https://docs.openstack.org/ceilometer/latest/install/install-base-rdo.html Creates the 'ceilometer' service entity with a description and type. ```bash $ openstack service create --name ceilometer \ --description "Telemetry" metering +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | Telemetry | | enabled | True | | id | 5fb7fd1bb2954fddb378d4031c28c0e4 | | name | ceilometer | | type | metering | +-------------+----------------------------------+ ``` -------------------------------- ### Metadata Fields Example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html Example of how to define metadata_fields for a dynamic pollster. ```yaml metadata_fields: - "labels" - "updated_at" - "keypair" - "master_flavor_id" - "api_address" - "master_addresses" - "node_count" - "docker_volume_size" - "master_count" - "node_addresses" - "status_reason" - "coe_version" - "cluster_template_id" - "name" - "stack_id" - "created_at" - "discovery_url" - "container_version" ``` -------------------------------- ### Skip Sample Values Example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html Example of how to define skip_sample_values for a dynamic pollster. ```yaml skip_sample_values: - "CREATE_FAILED" - "DELETE_FAILED" ``` -------------------------------- ### Pass options to testr via tox Source: https://docs.openstack.org/ceilometer/latest/contributor/testing.html Demonstrates how to pass options to testr (which tox wraps) to run specific tests, in this case, tests under tests/unit/image. ```bash tox -e py27 -- image ``` -------------------------------- ### Sample Ceilometer Configuration Source: https://docs.openstack.org/ceilometer/latest/configuration/index.html A sample configuration file for Ceilometer, showing various options. ```ini [DEFAULT] # # From ceilometer # # Polling namespace(s) to be used while resource polling (list value) #polling_namespaces = compute,central # DEPRECATED: Inspector to use for inspecting the hypervisor layer. (string # value) # Possible values: # libvirt - # This option is deprecated for removal. # Its value may be silently ignored in the future. # Reason: libvirt is the only supported hypervisor #hypervisor_inspector = libvirt # Libvirt domain type. (string value) # Possible values: # kvm - # lxc - # qemu - # parallels - #libvirt_type = kvm # Override the default libvirt URI (which is dependent on libvirt_type). # (string value) #libvirt_uri = # Swift reseller prefix. Must be on par with reseller_prefix in proxy- #server.conf. (string value) #reseller_prefix = AUTH_ # Configuration file for pipeline definition. (string value) #pipeline_cfg_file = pipeline.yaml # Configuration file for event pipeline definition. (string value) #event_pipeline_cfg_file = event_pipeline.yaml # Configuration file for polling definition. (string value) #cfg_file = polling.yaml # Path to directory where socket file for polling heartbeat will be created. # (string value) #heartbeat_socket_dir = # Work-load partitioning group prefix. Use only if you want to run multiple # polling agents with different config files. For each sub-group of the agent # pool with the same partitioning_group_prefix a disjoint subset of pollsters # should be loaded. (string value) #partitioning_group_prefix = # Batch size of samples to send to notification agent, Set to 0 to disable. # When prometheus exporter feature is used, this should be largered than # maximum number of samples per metric. (integer value) #batch_size = 50 # List of directories with YAML files used to created pollsters. (multi valued) #pollsters_definitions_dirs = /etc/ceilometer/pollsters.d # Identify project and user names from polled samples. By default, collecting # these values is disabled due to the fact that it could overwhelm keystone # service with lots of continuous requests depending upon the number of # projects, users and samples polled from the environment. While using this # feature, it is recommended that ceilometer be configured with a caching # backend to reduce the number of calls made to keystone. (boolean value) # Deprecated group/name - [DEFAULT]/tenant_name_discovery #identity_name_discovery = false # Whether the polling service should be sending notifications after polling # cycles. (boolean value) #enable_notifications = true # Allow this ceilometer polling instance to expose directly the retrieved # metrics in Prometheus format. (boolean value) #enable_prometheus_exporter = false # A list of ipaddr:port combinations on which the exported metrics will be # exposed. (list value) #prometheus_listen_addresses = 127.0.0.1:9101 # Whether the polling service should ignore disabled projects or not. (boolean # value) #ignore_disabled_projects = false # Whether it will expose tls metrics or not (boolean value) #prometheus_tls_enable = false # The certificate file to allow this ceilometer to expose tls scrape endpoints # (string value) #prometheus_tls_certfile = # The private key to allow this ceilometer to expose tls scrape endpoints # (string value) #prometheus_tls_keyfile = # The number of threads used to process the pollsters.The value one (1) means # that the processing is in aserial fashion (not ordered!). The value zero (0) # means that the we will use as much threads as the number of pollsters # configured in the polling task. Any otherpositive integer can be used to fix # an upper bound limitto the number of threads used for processing pollsters # inparallel. One must bear in mind that, using more than onethread might not # take full advantage of the discovery cache and pollsters cache processes; it # is possible though to improve/use pollsters that synchronize themselves in # the cache objects. (integer value) # Minimum value: 0 #threads_to_process_pollsters = 1 # Source for samples emitted on this instance. (string value) #sample_source = openstack ``` -------------------------------- ### JSON Response Handler Example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html Configuration snippet showing the 'json' response handler and example responses. ```yaml - name: "dynamic.json.response" sample_type: "gauge" [...] response_handlers: - json ``` ```json { "test": { "list": [1, 2, 3] } } ``` ```json { "test": { "list": [1, 2, 3] } } ``` -------------------------------- ### Run unit and code-style tests Source: https://docs.openstack.org/ceilometer/latest/contributor/testing.html Navigates to the Ceilometer directory and runs unit and code-style tests using tox. ```bash cd /opt/stack/ceilometer tox -e py27,pep8 ``` -------------------------------- ### Polling Rule Definition Example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-data-collection.html An example of the polling.yaml file structure, defining sources, intervals, meters, resources, and discovery. ```yaml --- sources: - name: 'source name' interval: 'how often the samples should be generated' meters: - 'meter filter' resources: - 'list of resource URLs' discovery: - 'list of discoverers' ``` -------------------------------- ### Complex linked response example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html Example of a complex API response with a 'next' link and its corresponding pollster configuration. ```json { "server_link": [ { "href": "http://test.com/v1/test-volumes/marker=c3", "rel": "next" }, { "href": "http://test.com/v1/test-volumes/marker=b1", "rel": "prev" } ], "servers": [ { "volume": [ { "name": "a", "tmp": "ra" } ], "id": 1, "name": "a1" }, { "volume": [ { "name": "b", "tmp": "rb" } ], "id": 2, "name": "b2" }, { "volume": [ { "name": "c", "tmp": "rc" } ], "id": 3, "name": "c3" } ] } ``` ```yaml --- - name: "dynamic.linked.response" sample_type: "gauge" unit: "request" value_attribute: "[volume].tmp" url_path: "v1/test-volumes" response_entries_key: "servers" next_sample_url_attribute: "server_link | filter(lambda v: v.get('rel') == 'next', value) | list(value) | value[0] | value.get('href')" ``` -------------------------------- ### Configure Ceilometer pipeline for Gnocchi Source: https://docs.openstack.org/ceilometer/latest/install/install-base-ubuntu.html Configures the 'publishers' section in /etc/ceilometer/pipeline.yaml to specify the Gnocchi endpoint and optional filtering. ```yaml publishers: # set address of Gnocchi # + filter out Gnocchi-related activity meters (Swift driver), # or use enable_filter_project=false to disable filtering # if not required # + set default archive policy - gnocchi://?filter_project=service&archive_policy=low ``` -------------------------------- ### Simple linked response example Source: https://docs.openstack.org/ceilometer/latest/admin/telemetry-dynamic-pollster.html Example of a simple API response and its corresponding pollster configuration to handle linked responses. ```json { "server_link": "http://test.com/v1/test-volumes/marker=c3", "servers": [ { "volume": [ { "name": "a", "tmp": "ra" } ], "id": 1, "name": "a1" }, { "volume": [ { "name": "b", "tmp": "rb" } ], "id": 2, "name": "b2" }, { "volume": [ { "name": "c", "tmp": "rc" } ], "id": 3, "name": "c3" } ] } ``` ```yaml --- - name: "dynamic.linked.response" sample_type: "gauge" unit: "request" value_attribute: "[volume].tmp" url_path: "v1/test-volumes" response_entries_key: "servers" next_sample_url_attribute: "server_link" ``` -------------------------------- ### Configure main pipeline Source: https://docs.openstack.org/ceilometer/latest/install/swift/install-swift-rdo.html Add 'ceilometer' to the pipeline in the [pipeline:main] section of proxy-server.conf. ```ini [pipeline:main] pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging ceilometer proxy-server ```