3.2. 设置监控客户端参数


监控解决方案定期收集系统信息,并提供使用数据收集代理以各种方式存储和监控值的机制。红帽支持 collectd 作为集合代理。collectd-sensubility 是 collectd 的扩展,通过 RabbitMQ 与 Sensu 服务器端通信。您可以使用 Service Telemetry Framework(STF)来存储数据,并依次、监控系统、查找性能瓶颈和预测将来的系统负载。有关 Service Telemetry Framework 的更多信息,请参阅 Service Telemetry Framework 1.3 指南。

要配置 collectd 和 collectd-sensubility,请完成以下步骤:

  1. 在主目录中创建 config.yaml,例如 /home/templates/custom,并将 MetricsQdrConnectors 参数配置为指向 STF 服务器端:

    MetricsQdrConnectors:
        - host: qdr-normal-sa-telemetry.apps.remote.tld
          port: 443
          role: inter-router
          sslProfile: sslProfile
          verifyHostname: false
    MetricsQdrSSLProfiles:
        - name: sslProfile
    Copy to Clipboard Toggle word wrap
  2. config.yaml 文件中,列出在 CollectdExtraPlugins 下要使用的插件。您还可以在 ExtraConfig 部分中提供参数。默认情况下,collectd 附带了 cpudfdiskhugepagesinterfaceloadmemoryprocesstcpconnsunixsock,以及 运行时间 插件。您可以使用 CollectdExtraPlugins 参数添加额外的插件。您还可以使用 ExtraConfig 选项为 CollectdExtraPlugins 提供额外的配置信息。例如,要启用 virt 插件,并配置连接字符串和主机名格式,请使用以下语法:

    parameter_defaults:
      CollectdExtraPlugins:
        - disk
        - df
        - virt
    
      ExtraConfig:
        collectd::plugin::virt::connection: "qemu:///system"
        collectd::plugin::virt::hostname_format: "hostname uuid"
    Copy to Clipboard Toggle word wrap
    注意

    不要删除 unixsock 插件。移除会导致 collectd 容器永久标记为不健康的。

  3. 可选: 要通过 AMQ Interconnect 收集指标和事件数据,请将行 MetricsQdrExternalEndpoint: true 添加到 config.yaml 文件中:

    parameter_defaults:
        MetricsQdrExternalEndpoint: true
    Copy to Clipboard Toggle word wrap
  4. 要启用 collectd-sensubility,请在 config.yaml 文件中添加以下环境配置:

    parameter_defaults:
      CollectdEnableSensubility: true
    
      # Use this if there is restricted access for your checks by using the sudo command.
      # The rule will be created in /etc/sudoers.d for sensubility to enable it calling restricted commands via sensubility executor.
      CollectdSensubilityExecSudoRule: "collectd ALL = NOPASSWD: <some command or ALL for all commands>"
    
      # Connection URL to Sensu server side for reporting check results.
      CollectdSensubilityConnection: "amqp://sensu:sensu@<sensu server side IP>:5672//sensu"
    
      # Interval in seconds for sending keepalive messages to Sensu server side.
      CollectdSensubilityKeepaliveInterval: 20
    
      # Path to temporary directory where the check scripts are created.
      CollectdSensubilityTmpDir: /var/tmp/collectd-sensubility-checks
    
      # Path to shell used for executing check scripts.
      CollectdSensubilityShellPath: /usr/bin/sh
    
      # To improve check execution rate use this parameter and value to change the number of goroutines spawned for executing check  scripts.
      CollectdSensubilityWorkerCount: 2
    
      # JSON-formatted definition of standalone checks to be scheduled on client side. If you need to schedule checks
      # on overcloud nodes instead of Sensu server, use this parameter. Configuration is compatible with Sensu check definition.
      # For more information, see https://docs.sensu.io/sensu-core/1.7/reference/checks/#check-definition-specification
      # There are some configuration options which sensubility ignores such as: extension, publish, cron, stdin, hooks.
      CollectdSensubilityChecks:
        example:
          command: "ping -c1 -W1 8.8.8.8"
          interval: 30
    
      # The following parameters are used to modify standard, standalone checks for monitoring container health on overcloud nodes.
      # Do not modify these parameters.
      # CollectdEnableContainerHealthCheck: true
      # CollectdContainerHealthCheckCommand: <snip>
      # CollectdContainerHealthCheckInterval: 10
      # The Sensu server side event handler to use for events created by the container health check.
      # CollectdContainerHealthCheckHandlers:
      #   - handle-container-health-check
      # CollectdContainerHealthCheckOccurrences: 3
      # CollectdContainerHealthCheckRefresh: 90
    Copy to Clipboard Toggle word wrap
  5. 部署 overcloud。在 overcloud 部署命令中包括 config.yamlcollectd-write-qdr.yaml 以及 overcloud 部署命令中的 qdr-*.yaml 文件之一:

    $ openstack overcloud deploy
    -e  /home/templates/custom/config.yaml
    -e tripleo-heat-templates/environments/metrics/collectd-write-qdr.yaml
    -e tripleo-heat-templates/environments/metrics/qdr-form-controller-mesh.yaml
    Copy to Clipboard Toggle word wrap
  6. 可选:要启用 overcloud RabbitMQ 监控,请在 overcloud deploy 命令中包含 collectd-read-rabbitmq.yaml 文件。

其他资源

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat