第 4 章 为服务 Telemetry Framework 配置 Red Hat OpenStack Platform

要收集指标、事件或两个对象,并将其发送到服务遥测框架(STF)存储域,您必须配置 Red Hat OpenStack Platform (RHOSP) overcloud 以启用数据收集和传输。

STF 可支持单一和多个云。RHOSP 和 STF 中的默认配置为单个云安装设置。

4.1. 为服务 Telemetry Framework 部署 Red Hat OpenStack Platform overcloud

要配置 Red Hat OpenStack Platform (RHOSP) overcloud,您必须配置数据收集器,并将数据传输配置为服务 Telemetry Framework (STF),并且部署 overcloud。

其他资源

4.1.1. 检索 AMQ Interconnect 路由地址

为服务 Telemetry Framework (STF)配置 Red Hat OpenStack Platform (RHOSP) overcloud 时,必须在 STF 连接文件中提供 AMQ Interconnect 路由地址。

流程

  1. 登录您的 Red Hat OpenShift Container Platform 环境。
  2. service-telemetry 项目中,检索 AMQ Interconnect 路由地址:

    $ oc get routes -ogo-template='{{ range .items }}{{printf "%s\n" .spec.host }}{{ end }}' | grep "\-5671"
    default-interconnect-5671-service-telemetry.apps.infra.watch

4.1.2. 为 STF 创建基本配置

要配置基础参数,以便为服务 Telemetry Framework (STF)提供兼容数据收集和传输,您必须创建一个定义默认数据收集值的文件。

流程

  1. stack 用户身份登录 Red Hat OpenStack Platform (RHOSP) undercloud。
  2. /home/stack 目录中创建一个名为 enable-stf.yaml 的配置文件。

    重要

    EventPipelinePublishersPipelinePublishers 设置为空列表会导致事件或指标数据传递到 RHOSP 传统遥测组件,如 Gnocchi 或 Panko。如果您需要将数据发送到其他管道,CeiloConfig 中的 Ceilometer 轮询间隔为 30 秒,则可能会在 ExtraConfig 中指定,可能会给旧组件而造成的,且您必须将间隔增加到更大值,如 300。将该值增大到较长的轮询间隔会导致 STF 中的遥测分辨率减少。

    要使用 STF 和 Gnocchi 启用遥测集合,请参阅 第 4.2 节 “将指标发送到 Gnocchi 和服务遥测框架”

parameter_defaults:
    # only send to STF, not other publishers
    EventPipelinePublishers: []
    PipelinePublishers: []

    # manage the polling and pipeline configuration files for Ceilometer agents
    ManagePolling: true
    ManagePipeline: true

    # enable Ceilometer metrics and events
    CeilometerQdrPublishMetrics: true
    CeilometerQdrPublishEvents: true

    # enable collection of API status
    CollectdEnableSensubility: true
    CollectdSensubilityTransport: amqp1
    CollectdSensubilityResultsChannel: sensubility/telemetry

    # enable collection of containerized service metrics
    CollectdEnableLibpodstats: true

    # set collectd overrides for higher telemetry resolution and extra plugins
    # to load
    CollectdConnectionType: amqp1
    CollectdAmqpInterval: 5
    CollectdDefaultPollingInterval: 5
    CollectdExtraPlugins:
    - vmem

    # set standard prefixes for where metrics and events are published to QDR
    MetricsQdrAddresses:
    - prefix: 'collectd'
      distribution: multicast
    - prefix: 'anycast/ceilometer'
      distribution: multicast

    ExtraConfig:
        ceilometer::agent::polling::polling_interval: 30
        ceilometer::agent::polling::polling_meters:
        - cpu
        - disk.*
        - ip.*
        - image.*
        - memory
        - memory.*
        - network.*
        - perf.*
        - port
        - port.*
        - switch
        - switch.*
        - storage.*
        - volume.*

        # to avoid filling the memory buffers if disconnected from the message bus
        collectd::plugin::amqp1::send_queue_limit: 50

        # receive extra information about virtual memory
        collectd::plugin::vmem::verbose: true

        # provide name and uuid in addition to hostname for better correlation
        # to ceilometer data
        collectd::plugin::virt::hostname_format: "name uuid hostname"

        # provide the human-friendly name of the virtual instance
        collectd::plugin::virt::plugin_instance_format: metadata

        # set memcached collectd plugin to report its metrics by hostname
        # rather than host IP, ensuring metrics in the dashboard remain uniform
        collectd::plugin::memcached::instances:
          local:
            host: "%{hiera('fqdn_canonical')}"
            port: 11211

4.1.3. 为 overcloud 配置 STF 连接

要配置 Service Telemetry Framework (STF)连接,您必须创建一个文件,其中包含用于 overcloud 的 AMQ Interconnect 的连接配置到 STF 部署。启用 STF 中事件的事件和存储的集合,并且部署 overcloud。默认配置适用于具有默认消息总线主题的单一云实例。有关配置多个云部署,请参阅 第 4.4 节 “配置多个云”

前提条件

流程

  1. stack 用户身份登录到 RHOSP undercloud。
  2. /home/stack 目录中创建一个名为 stf-connectors.yaml 的配置文件。
  3. stf-connectors.yaml 文件中,配置 MetricsQdrConnectors 地址,将 overcloud 上的 AMQ Interconnect 连接到 STF 部署。

    parameter_defaults:
        MetricsQdrConnectors:
        - host: default-interconnect-5671-service-telemetry.apps.infra.watch
          port: 443
          role: edge
          sslProfile: sslProfile
          verifyHostname: false
    
        MetricsQdrSSLProfiles:
        -   name: sslProfile

4.1.4. 部署 overcloud

使用所需的环境文件部署或更新 overcloud,以便收集数据并将其传输到服务遥测框架(STF)。

流程

  1. stack 用户身份登录 Red Hat OpenStack Platform (RHOSP) undercloud。
  2. 提供身份验证文件:

    [stack@undercloud-0 ~]$ source stackrc
    
    (undercloud) [stack@undercloud-0 ~]$
  3. 在 RHOSP director 部署中添加以下文件来配置数据收集和 AMQ Interconnect:

    • collectd-write-qdr.yaml 文件,以确保 collectd 遥测和事件发送到 STF
    • ceilometer-write-qdr.yaml 文件,以确保 Ceilometer 遥测和事件发送到 STF
    • qdr-edge-only.yaml 文件,以确保消息总线被启用并连接到 STF 消息总线路由器
    • enable-stf.yaml 环境文件,以确保正确配置了默认值
    • stf-connectors.yaml 环境文件来定义到 STF 的连接

      (undercloud) [stack@undercloud-0 ~]$ openstack overcloud deploy <other_arguments>
      --templates /usr/share/openstack-tripleo-heat-templates \
        --environment-file <...other_environment_files...> \
        --environment-file /usr/share/openstack-tripleo-heat-templates/environments/metrics/ceilometer-write-qdr.yaml \
        --environment-file /usr/share/openstack-tripleo-heat-templates/environments/metrics/collectd-write-qdr.yaml \
        --environment-file /usr/share/openstack-tripleo-heat-templates/environments/metrics/qdr-edge-only.yaml \
        --environment-file /home/stack/enable-stf.yaml \
        --environment-file /home/stack/stf-connectors.yaml
  4. 部署 overcloud。

4.1.5. 验证客户端安装

要验证 Service Telemetry Framework (STF)存储域的数据收集,请查询数据源以传送数据。要在 Red Hat OpenStack Platform (RHOSP)部署中验证单个节点,请使用 SSH 连接到控制台。

提示

某些遥测数据仅在 RHOSP 具有活跃工作负载时才可用。

流程

  1. 登录 overcloud 节点,如 controller-0。
  2. 确保 metrics_qdr 容器在节点上运行:

    $ sudo podman container inspect --format '{{.State.Status}}' metrics_qdr
    
    running
  3. 返回运行 AMQ Interconnect 的内部网络地址,如 172.17.1.44 侦听端口 5666

    $ sudo podman exec -it metrics_qdr cat /etc/qpid-dispatch/qdrouterd.conf
    
    listener {
        host: 172.17.1.44
        port: 5666
        authenticatePeer: no
        saslMechanisms: ANONYMOUS
    }
  4. 返回到本地 AMQ Interconnect 的连接列表:

    $ sudo podman exec -it metrics_qdr qdstat --bus=172.17.1.44:5666 --connections
    
    Connections
      id   host                                                                  container                                                                                                  role    dir  security                            authentication  tenant
      ============================================================================================================================================================================================================================================================================================
      1    default-interconnect-5671-service-telemetry.apps.infra.watch:443      default-interconnect-7458fd4d69-bgzfb                                                                      edge    out  TLSv1.2(DHE-RSA-AES256-GCM-SHA384)  anonymous-user
      12   172.17.1.44:60290                                                     openstack.org/om/container/controller-0/ceilometer-agent-notification/25/5c02cee550f143ec9ea030db5cccba14  normal  in   no-security                         no-auth
      16   172.17.1.44:36408                                                     metrics                                                                                                    normal  in   no-security                         anonymous-user
      899  172.17.1.44:39500                                                     10a2e99d-1b8a-4329-b48c-4335e5f75c84                                                                       normal  in   no-security                         no-auth

    有四个连接:

    • 出站到 STF 的连接
    • 来自 ceilometer 的入站连接
    • collectd 的入站连接
    • 来自 qdstat 客户端的入站连接

      出站 STF 连接提供给 MetricsQdrConnectors 主机参数,是 STF 存储域的路由。其他主机是与这个 AMQ Interconnect 的客户端连接的内部网络地址。

  5. 为确保传递信息,列出链接,并在 deliv 列中查看用于传递消息的 _edge 地址:

    $ sudo podman exec -it metrics_qdr qdstat --bus=172.17.1.44:5666 --links
    Router Links
      type      dir  conn id  id    peer  class   addr                  phs  cap  pri  undel  unsett  deliv    presett  psdrop  acc  rej  rel     mod  delay  rate
      ===========================================================================================================================================================
      endpoint  out  1        5           local   _edge                      250  0    0      0       2979926  0        0       0    0    2979926 0    0      0
      endpoint  in   1        6                                              250  0    0      0       0        0        0       0    0    0       0    0      0
      endpoint  in   1        7                                              250  0    0      0       0        0        0       0    0    0       0    0      0
      endpoint  out  1        8                                              250  0    0      0       0        0        0       0    0    0       0    0      0
      endpoint  in   1        9                                              250  0    0      0       0        0        0       0    0    0       0    0      0
      endpoint  out  1        10                                             250  0    0      0       911      911      0       0    0    0       0    911    0
      endpoint  in   1        11                                             250  0    0      0       0        911      0       0    0    0       0    0      0
      endpoint  out  12       32          local   temp.lSY6Mcicol4J2Kp       250  0    0      0       0        0        0       0    0    0       0    0      0
      endpoint  in   16       41                                             250  0    0      0       2979924  0        0       0    0    2979924 0    0      0
      endpoint  in   912      1834        mobile  $management           0    250  0    0      0       1        0        0       1    0    0       0    0      0
      endpoint  out  912      1835        local   temp.9Ok2resI9tmt+CT       250  0    0      0       0        0        0       0    0    0       0    0      0
  6. 要列出来自 RHOSP 节点到 STF 的地址,请连接到 Red Hat OpenShift Container Platform 以检索 AMQ Interconnect pod 名称,并列出连接。列出可用的 AMQ Interconnect pod:

    $ oc get pods -l application=default-interconnect
    
    NAME                                    READY   STATUS    RESTARTS   AGE
    default-interconnect-7458fd4d69-bgzfb   1/1     Running   0          6d21h
  7. 连接到 pod 并列出已知的连接。在本例中,有来自 RHOSP 节点的三个 边缘 连接,其连接 id 为 22, 23, 和 24。

    $ oc exec -it default-interconnect-7458fd4d69-bgzfb -- qdstat --connections
    
    2020-04-21 18:25:47.243852 UTC
    default-interconnect-7458fd4d69-bgzfb
    
    Connections
      id  host               container                                                      role    dir  security                                authentication  tenant  last dlv      uptime
      ===============================================================================================================================================================================================
      5   10.129.0.110:48498  bridge-3f5                                                    edge    in   no-security                             anonymous-user          000:00:00:02  000:17:36:29
      6   10.129.0.111:43254  rcv[default-cloud1-ceil-meter-smartgateway-58f885c76d-xmxwn]  edge    in   no-security                             anonymous-user          000:00:00:02  000:17:36:20
      7   10.130.0.109:50518  rcv[default-cloud1-coll-event-smartgateway-58fbbd4485-rl9bd]  normal  in   no-security                             anonymous-user          -             000:17:36:11
      8   10.130.0.110:33802  rcv[default-cloud1-ceil-event-smartgateway-6cfb65478c-g5q82]  normal  in   no-security                             anonymous-user          000:01:26:18  000:17:36:05
      22  10.128.0.1:51948   Router.ceph-0.redhat.local                                     edge    in   TLSv1/SSLv3(DHE-RSA-AES256-GCM-SHA384)  anonymous-user          000:00:00:03  000:22:08:43
      23  10.128.0.1:51950   Router.compute-0.redhat.local                                  edge    in   TLSv1/SSLv3(DHE-RSA-AES256-GCM-SHA384)  anonymous-user          000:00:00:03  000:22:08:43
      24  10.128.0.1:52082   Router.controller-0.redhat.local                               edge    in   TLSv1/SSLv3(DHE-RSA-AES256-GCM-SHA384)  anonymous-user          000:00:00:00  000:22:08:34
      27  127.0.0.1:42202    c2f541c1-4c97-4b37-a189-a396c08fb079                           normal  in   no-security                             no-auth                 000:00:00:00  000:00:00:00
  8. 要查看网络发送的消息数量,请使用 oc exec 命令的每个地址:

    $ oc exec -it default-interconnect-7458fd4d69-bgzfb -- qdstat --address
    
    2020-04-21 18:20:10.293258 UTC
    default-interconnect-7458fd4d69-bgzfb
    
    Router Addresses
      class   addr                                phs  distrib    pri  local  remote  in           out          thru  fallback
      ==========================================================================================================================
      mobile  anycast/ceilometer/event.sample     0    balanced   -    1      0       970          970          0     0
      mobile  anycast/ceilometer/metering.sample  0    balanced   -    1      0       2,344,833    2,344,833    0     0
      mobile  collectd/notify                     0    multicast  -    1      0       70           70           0     0
      mobile  collectd/telemetry                  0    multicast  -    1      0       216,128,890  216,128,890  0     0