Enable the Gnocchi archive policies in Tenant Telemetry

Enable the Gnocchi archive policies in Tenant Telemetry

The Gnocchi archive policies allow you to define the aggregation and storage policies for metrics received from Ceilometer.

Each archive policy definition is set as the number of points over a timespan. The default archive policy contains two definitions and one rule. It allows you to store metrics for seven days with granularity of one minute and for 365 days with granularity of one hour. It is applied to any metrics sent to Gnocchi with the metric pattern *. You can customize all parameters on the cluster level of your Reclass model.

To enable the Gnocchi archive policies:

  1. Open your Git project repository with the Reclass model on the cluster level.

  2. In /openstack/telemetry.yml, verify that the following class is present:

    classes:
    ...
    - system.ceilometer.server.backend.gnocchi
    
  3. In /openstack/control/init.yml, add the following classes:

    classes:
    ...
    - system.gnocchi.client
    - system.gnocchi.client.v1.archive_policy.default
    

    The parameters of system.gnocchi.client.v1.archive_policy.default are as follows:

    parameters:
      _param:
        gnocchi_default_policy_granularity_1: '0:01:00'
        gnocchi_default_policy_points_1: 10080
        gnocchi_default_policy_timespan_1: '7 days'
        gnocchi_default_policy_granularity_2: '1:00:00'
        gnocchi_default_policy_points_2: 8760
        gnocchi_default_policy_timespan_2: '365 days'
        gnocchi_default_policy_rule_metric_pattern: '"*"'
      gnocchi:
        client:
          resources:
            v1:
              enabled: true
              cloud_name: 'admin_identity'
              archive_policies:
                default:
                  definition:
                    - granularity: "${_param:gnocchi_default_policy_granularity_1}"
                      points: "${_param:gnocchi_default_policy_points_1}"
                      timespan: "${_param:gnocchi_default_policy_timespan_1}"
                    - granularity: "${_param:gnocchi_default_policy_granularity_2}"
                      points: "${_param:gnocchi_default_policy_points_2}"
                      timespan: "${_param:gnocchi_default_policy_timespan_2}"
                  rules:
                    default:
                      metric_pattern: "${_param:gnocchi_default_policy_rule_metric_pattern}"
    
  4. Optional. Specify additional archive policies as required. For example, to aggregate the CPU and disk-related metrics with the timespan of 30 days and granularity 1, add the following parameters to /openstack/control/init.yml under the default Gnocchi archive policy parameters:

    parameters:
      _param:
      ...
      gnocchi:
        client:
          resources:
            v1:
              enabled: true
              cloud_name: 'admin_identity'
              archive_policies:
                default:
                ...
                cpu_disk_policy:
                  definition:
                    - granularity: '0:00:01'
                      points: 2592000
                      timespan: '30 days'
                  rules:
                  cpu_rule:
                    metric_pattern: 'cpu*'
                  disk_rule:
                    metric_pattern: 'disk*'
    

    Caution

    Rule names defined across archive policies must be unique.

  5. Log in to the Salt Master node.

  6. Apply the following states:

    salt -C 'I@gnocchi:client and *01*' saltutil.pillar_refresh
    salt -C 'I@gnocchi:client and *01*' state.sls gnocchi.client
    salt -C 'I@gnocchi:client' state.sls gnocchi.client
    
  7. Verify that the archive policies are set successfully:

    1. Log in to any OpenStack controller node.

    2. Boot a test VM:

      source keystonercv3
      openstack server create --flavor <flavor_id> \
      --nic net-id=<net_id> --image <image_id>  test_vm1
      
    3. Run the following command:

      openstack metric list | grep <vm_id>
      

      Use the vm_id parameter value from the output of the command that you run in the previous step.

      Example of system response extract:

      +---------+-------------------+-------------------------------+------+-----------+
      | id      |archive_policy/name| name                          | unit |resource_id|
      +---------+-------------------+-------------------------------+------+-----------+
      | 0ace... | cpu_disk_policy   | disk.allocation               | B    | d9011...  |
      | 0ca6... | default           | perf.instructions             | None | d9011...  |
      | 0fcb... | default           | compute.instance.booting.time | sec  | d9011...  |
      | 10f0... | cpu_disk_policy   | cpu_l3_cache                  | None | d9011...  |
      | 2392... | default           | memory                        | MB   | d9011...  |
      | 2395... | cpu_disk_policy   | cpu_util                      | %    | d9011...  |
      | 26a0... | default           | perf.cache.references         | None | d9011...  |
      | 367e... | cpu_disk_policy   | disk.read.bytes.rate          | B/s  | d9011...  |
      | 3857... | default           | memory.bandwidth.total        | None | d9011...  |
      | 3bb2... | default           | memory.usage                  | None | d9011...  |
      | 4288... | cpu_disk_policy   | cpu                           | ns   | d9011...  |
      +---------+-------------------+-------------------------------+------+-----------+
      

    In the example output above, all metrics are aggregated using the default archive policy except for the CPU and disk metrics aggregated by cpu_disk_policy. The cpu_disk_policy parameters were previously customized in the Reclass model.