Red Hat OpenStack Platform Operational Tools


Red Hat OpenStack Platform 8

OpenStack 环境的集中式日志记录和监控

OpenStack Documentation Team

摘要

本文档描述了提供集中日志记录、可用性监控和性能监控的操作工具的安装和配置。

前言

Red Hat OpenStack Platform 附带一个可选的工具套件,旨在帮助操作员维护 OpenStack 环境。该工具执行以下功能:

  • 集中式日志记录
  • 可用性监控
  • 性能监控

本文档描述了这些工具的准备和安装。

警告

Red Hat OpenStack Platform Operational Tool Suite 当前还只是一个技术预览。有关红帽 技术预览的更多信息,请参阅技术预览功能支持范围

第 1 章 架构

1.1. 集中式日志记录

集中式日志记录链由多个组件组成,包括:

  • 日志集合代理(Fluentd)
  • 日志中继/Transformer (Fluentd)
  • 数据存储(Elasticsearch)
  • API/Presentation Layer (Kibana)

这些组件及其交互在下图中布局:

图 1.1. 集中式日志记录架构在高级别上

图 1.2. Red Hat OpenStack Platform 的单节点部署

图 1.3. Red Hat OpenStack Platform 的 HA 部署

1.2. 可用性监控

可用性监控工具链由多个组件组成,包括:

  • 监测代理(Sensu)
  • 监控中继/代理(RabbitMQ)
  • 监控控制器/服务器(Sensu)
  • 一个 API/Presentation Layer (Uchiwa)

这些组件及其交互在下图中布局:

图 1.4. 高级别的可用性监控架构

图 1.5. Red Hat OpenStack Platform 的单节点部署

图 1.6. Red Hat OpenStack Platform 的 HA 部署

1.3. 性能监控

性能监控工具链由多个组件组成,包括:

  • 集合代理(集合代理)
  • Collection Aggregator/Relay (Graphite)
  • 数据存储(whisperdb)
  • 一个 API/Presentation Layer (Grafana)

这些组件及其交互在下图中布局:

图 1.7. 高级别的性能监控架构

图 1.8. Red Hat OpenStack Platform 的单节点部署

图 1.9. Red Hat OpenStack Platform 的 HA 部署

第 2 章 安装集中日志记录套件

2.1. 安装集中式 Log Relay/Transformer

  1. 找到满足以下最低规格的裸机系统:

    • 8 GB 内存
    • 单套接字 Xeon 类 CPU
    • 500 GB 磁盘空间
  2. Install Red Hat Enterprise Linux 7.
  3. 允许系统访问 Operational Tools 软件包:

    1. 注册系统并订阅它:

      # subscription-manager register
      # subscription-manager list --consumed
      Copy to Clipboard Toggle word wrap

      如果没有自动附加 OpenStack 订阅,请参阅有关 手动附加订阅 的文档。

    2. 禁用初始启用的存储库,仅启用适合 Operational Tools 的仓库:

      # subscription-manager repos --disable=*
      # subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-7-server-optional-rpms --enable=rhel-7-server-openstack-8-optools-rpms
      Copy to Clipboard Toggle word wrap
      注意

      此节点上不能启用基础 OpenStack 存储库(rhel-7-server-openstack-8-rpms)。此软件仓库可能包含某些 Operational Tools 依赖项的较新版本,这些依赖项可能与 Operational Tools 软件包不兼容。

  4. 运行以下命令安装 ElasticsearchFluentdKibana 软件:

    # yum install elasticsearch fluentd rubygem-fluent-plugin-elasticsearch kibana httpd
    Copy to Clipboard Toggle word wrap
  5. Elasticsearch 中启用跨原始资源共享(CORS)。要做到这一点,请编辑 /etc/elasticsearch/elasticsearch.yml,并在文件的末尾添加以下行:

    http.cors.enabled: true
    http.cors.allow-origin: "/.*/"
    Copy to Clipboard Toggle word wrap
    注意

    这将允许从任何 Web 服务器的任何网页调用 Elasticsearch JavaScript 应用程序。要只允许 Kibana 服务器中的 CORS,请使用:

    http.cors.allow-origin: "http://LOGGING_SERVER"
    Copy to Clipboard Toggle word wrap

    LOGGING_SERVER 替换为 Kibana 服务器的 IP 地址或主机名,具体取决于您要使用 IP 地址或主机名访问 Kibana。但是,如果 Elasticsearch 服务只能从可信主机访问,则可以安全地使用 "/signal/ "。

  6. 启动 Elasticsearch 实例并在引导时启用它:

    # systemctl start elasticsearch
    # systemctl enable elasticsearch
    Copy to Clipboard Toggle word wrap

    要确认 Elasticsearch 实例正常工作,请运行以下命令:

    # curl http://localhost:9200/
    Copy to Clipboard Toggle word wrap

    这应该给出类似如下的响应:

    {
      "status" : 200,
      "name" : "elasticsearch.example.com",
      "cluster_name" : "elasticsearch",
      "version" : {
        "number" : "1.5.2",
        "build_hash" : "c88f77ffc81301dfa9dfd81ca2232f09588bd512",
        "build_timestamp" : "2015-02-19T13:05:36Z",
        "build_snapshot" : false,
        "lucene_version" : "4.10.3"
      },
      "tagline" : "You Know, for Search"
    }
    Copy to Clipboard Toggle word wrap
  7. 配置 Fluentd 以接受日志数据并将其写入 Elasticsearch。编辑 /etc/fluentd/fluent.conf,并将其内容替换为以下内容:

    # In v1 configuration, type and id are @ prefix parameters.
    # @type and @id are recommended. type and id are still available for backward compatibility
    
    <source>
      @type forward
      port 4000
      bind 0.0.0.0
    </source>
    
    <match **>
      @type elasticsearch
      host localhost
      port 9200
      logstash_format true
      flush_interval 5
    </match>
    Copy to Clipboard Toggle word wrap
  8. 启动 Fluentd 并在引导时启用它:

    # systemctl start fluentd
    # systemctl enable fluentd
    Copy to Clipboard Toggle word wrap
    提示

    检查 Fluentd 的日志,并确保它在启动时没有错误:

    # journalctl -u fluentd -l -f
    Copy to Clipboard Toggle word wrap
  9. 配置 Kibana 以指向 Elasticsearch 实例。创建 /etc/httpd/conf.d/kibana3.conf,并将以下内容放在:

    <VirtualHost *:80>
    
      DocumentRoot /usr/share/kibana
      <Directory /usr/share/kibana>
        Require all granted
        Options -Multiviews
      </Directory>
    
    </VirtualHost>
    Copy to Clipboard Toggle word wrap
  10. 如果要将对 KibanaElasticsearch 的访问限制为授权用户,例如,由于这些服务在开放网络中的系统上运行,请使用 HTTP 基本身份验证保护虚拟主机,并在代理后移动 Elasticseach。要做到这一点,请按照以下步骤执行:

    1. 使用以下内容创建(或重写) /etc/httpd/conf.d/kibana3.conf 文件:

      <VirtualHost *:80>
      
        DocumentRoot /usr/share/kibana
        <Directory /usr/share/kibana>
          Options -Multiviews
          AuthUserFile /etc/httpd/conf/htpasswd-kibana
          AuthName "Restricted Kibana Server"
          AuthType Basic
          Require valid-user
        </Directory>
      
        # Proxy for Elasticsearch
        <LocationMatch "^/(_nodes|_aliases|.*/_aliases|_search|.*/_search|_mapping|.*/_mapping)$">
          ProxyPassMatch http://127.0.0.1:9200/$1
          ProxyPassReverse http://127.0.0.1:9200/$1
        </LocationMatch>
      
        # Proxy for kibana-int/{dashboard,temp}
        <LocationMatch "^/(kibana-int/dashboard/|kibana-int/temp)(.*)$">
          ProxyPassMatch http://127.0.0.1:9200/$1$2
          ProxyPassReverse http://127.0.0.1:9200/$1$2
        </LocationMatch>
      
      </Virtualhost>
      Copy to Clipboard Toggle word wrap
      注意

      您可以将不同的路径用于 AuthUserFile 选项,以及 AuthName 选项的任何其他描述。

    2. 创建允许访问 Kibana 的一对用户名和密码。为此,请运行以下命令:

      # htpasswd -c /etc/httpd/conf/htpasswd-kibana user_name
      Copy to Clipboard Toggle word wrap
      注意

      如果您将不同的路径用于 AuthUserFile 选项,请相应地更改命令。

      使用您选择的用户名替换 user_name。出现提示时,输入将与此用户名一起使用的密码。系统将提示您重新键入密码。

    3. 另外,运行以下命令来创建具有自己密码的更多用户:

      # htpasswd /etc/httpd/conf/htpasswd-kibana another_user_name
      Copy to Clipboard Toggle word wrap
    4. Elasticsearch 配置为仅侦听 localhost 接口。要做到这一点,请在编辑器中打开 /etc/elasticsearch/elasticsearch.yml 文件,并附加以下选项:

      network.host: 127.0.0.1
      Copy to Clipboard Toggle word wrap
    5. 您还可以通过将以下选项附加到 /etc/elasticsearch/elasticsearch.yml,将 Elasticsearch 配置为允许在 CORS 中使用 HTTP 基本身份验证数据:

      http.cors.allow-credentials: true
      Copy to Clipboard Toggle word wrap
    6. 重启 Elasticsearch 以使更改生效:

      # systemctl restart elasticsearch
      Copy to Clipboard Toggle word wrap
    7. 最后,确保使用代理下载 Elasticsearch 文件,并且浏览器发送 HTTP 基本身份验证数据。为此,请编辑 /usr/share/kibana/config.js 文件。在此文件中找到以下行:

      elasticsearch: "http://"+window.location.hostname+":9200",
      Copy to Clipboard Toggle word wrap

      按如下所示更改它:

      elasticsearch: {server: "http://"+window.location.hostname, withCredentials: true},
      Copy to Clipboard Toggle word wrap
  11. 启用 Kibana (在 Apache 之外)连接到 Elasticsearch,然后启动 Apache 并在引导时启用它:

    # setsebool -P httpd_can_network_connect 1
    # systemctl start httpd
    # systemctl enable httpd
    Copy to Clipboard Toggle word wrap
  12. 在系统上打开防火墙,以允许连接到 Fluentdhttpd

    # firewall-cmd --zone=public --add-port=4000/tcp --permanent
    # firewall-cmd --zone=public --add-service=http --permanent
    # firewall-cmd --reload
    Copy to Clipboard Toggle word wrap
  13. 另外,如果您还没有配置 HTTP 身份验证和 Elasticsearch 代理,请打开防火墙以允许到 Elasticsearch 的直接连接:

    # firewall-cmd --zone=public --add-port=9200/tcp --permanent
    # firewall-cmd --reload
    Copy to Clipboard Toggle word wrap
    重要

    如果您不限制对使用 HTTP 身份验证的 KibanaElasticseach 的访问,则 Kibana 和 Elasticsearch 提供的信息可在没有任何身份验证的情况下供任何人使用。为了保护数据,请确保系统或打开的 TCP 端口(80、4000 和 9200)只能从可信主机访问。

2.2. 在所有节点上安装日志集合代理

要从 OpenStack 环境中所有系统收集日志并将其发送到集中式日志记录服务器,请在所有 OpenStack 系统上运行以下命令:

  1. 启用 Operational Tools 存储库:

    # subscription-manager repos --enable=rhel-7-server-openstack-8-optools-rpms
    Copy to Clipboard Toggle word wrap
  2. 安装 fluentdrubygem-fluent-plugin-add

    # yum install fluentd rubygem-fluent-plugin-add
    Copy to Clipboard Toggle word wrap
  3. 配置 Fluentd 用户,使其具有读取所有 OpenStack 日志文件的权限。运行以下命令来完成此操作:

    # for user in {keystone,nova,neutron,cinder,glance}; do usermod -a -G $user fluentd; done
    Copy to Clipboard Toggle word wrap

    请注意,您可能会在某些节点上收到有关缺失组的错误。这可以忽略,因为所有节点都运行所有服务。

  4. 配置 Fluentd。确保 /etc/fluentd/fluent.conf 如下所示;请务必将 LOGGING_SERVER 替换为上述配置的集中式日志记录服务器的主机名或 IP 地址:

    # In v1 configuration, type and id are @ prefix parameters.
    # @type and @id are recommended. type and id are still available for backward compatibility
    
    # Nova compute
    <source>
      @type tail
      path /var/log/nova/nova-compute.log
      tag nova.compute
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match nova.compute>
      type add
      <pair>
        service nova.compute
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Nova API
    <source>
      @type tail
      path /var/log/nova/nova-api.log
      tag nova.api
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match nova.api>
      type add
      <pair>
        service nova.api
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Nova Cert
    <source>
      @type tail
      path /var/log/nova/nova-cert.log
      tag nova.cert
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match nova.cert>
      type add
      <pair>
        service nova.cert
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Nova Conductor
    <source>
      @type tail
      path /var/log/nova/nova-conductor.log
      tag nova.conductor
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match nova.conductor>
      type add
      <pair>
        service nova.conductor
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Nova Consoleauth
    <source>
      @type tail
      path /var/log/nova/nova-consoleauth.log
      tag nova.consoleauth
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match nova.consoleauth>
      type add
      <pair>
        service nova.consoleauth
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Nova Scheduler
    <source>
      @type tail
      path /var/log/nova/nova-scheduler.log
      tag nova.scheduler
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match nova.scheduler>
      type add
      <pair>
        service nova.scheduler
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Neutron Openvswitch Agent
    <source>
      @type tail
      path /var/log/neutron/openvswitch-agent.log
      tag neutron.openvswitch
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match neutron.openvswitch>
      type add
      <pair>
        service neutron.openvswitch
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Neutron Server
    <source>
      @type tail
      path /var/log/neutron/server.log
      tag neutron.server
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match neutron.server>
      type add
      <pair>
        service neutron.server
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Neutron DHCP Agent
    <source>
      @type tail
      path /var/log/neutron/dhcp-agent.log
      tag neutron.dhcp
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match neutron.dhcp>
      type add
      <pair>
        service neutron.dhcp
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Neutron L3 Agent
    <source>
      @type tail
      path /var/log/neutron/l3-agent.log
      tag neutron.l3
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match neutron.l3>
      type add
      <pair>
        service neutron.l3
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Neutron Metadata Agent
    <source>
      @type tail
      path /var/log/neutron/metadata-agent.log
      tag neutron.metadata
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match neutron.metadata>
      type add
      <pair>
        service neutron.metadata
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Keystone
    <source>
      @type tail
      path /var/log/keystone/keystone.log
      tag keystone
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match keystone>
      type add
      <pair>
        service keystone
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Glance API
    <source>
      @type tail
      path /var/log/glance/api.log
      tag glance.api
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match glance.api>
      type add
      <pair>
        service glance.api
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Glance Registry
    <source>
      @type tail
      path /var/log/glance/registry.log
      tag glance.registry
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match glance.registry>
      type add
      <pair>
        service glance.registry
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Cinder API
    <source>
      @type tail
      path /var/log/cinder/api.log
      tag cinder.api
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match cinder.api>
      type add
      <pair>
        service cinder.api
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Cinder Scheduler
    <source>
      @type tail
      path /var/log/cinder/scheduler.log
      tag cinder.scheduler
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match cinder.scheduler>
      type add
      <pair>
        service cinder.scheduler
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    # Cinder Volume
    <source>
      @type tail
      path /var/log/cinder/volume.log
      tag cinder.volume
      format multiline
      format_firstline /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      format /(?<time>[^ ]* [^ ]*) (?<pid>[^ ]*) (?<loglevel>[^ ]*) (?<class>[^ ]*) \[(?<context>.*)\] (?<message>.*)/
      time_format %F %T.%L
    </source>
    
    <match cinder.volume>
      type add
      <pair>
        service cinder.volume
        hostname "#{Socket.gethostname}"
      </pair>
    </match>
    
    <match greped.**>
      @type forward
      heartbeat_type tcp
      <server>
        name LOGGING_SERVER
        host LOGGING_SERVER
        port 4000
      </server>
    </match>
    Copy to Clipboard Toggle word wrap
  5. 现在,Fluentd 已被配置,启动 Fluentd 服务并在引导时启用它:

    # systemctl start fluentd
    # systemctl enable fluentd
    Copy to Clipboard Toggle word wrap

现在,您应该可以访问在 http://LOGGING_SERVER/index.html Slack/dashboard/file/logstash.json 中运行的 Kibana,并查看日志开始填充。如果您在 Kibana 配置中启用了 HTTP 基本身份验证,您必须输入有效的用户名和密码来访问此页面。

注意

默认情况下,日志记录服务器的前端页面 http://LOGGING_SERVER/ 是用于提供技术要求和其他配置信息的 Kibana 欢迎屏幕。如果您希望日志在此处可用,请将 Kibana 应用程序目录中的 default.json 文件替换为 logstash.json,但首先创建一个 default.json 的备份副本,以备将来需要此文件:

# mv /usr/share/kibana/app/dashboards/default.json /usr/share/kibana/app/dashboards/default.json.orig
# cp /usr/share/kibana/app/dashboards/logstash.json /usr/share/kibana/app/dashboards/default.json
Copy to Clipboard Toggle word wrap

第 3 章 安装可用性监控套件

3.1. 安装 Monitoring Relay/Controller

  1. 找到满足以下最低规格的裸机系统:

    • 4 GB 内存
    • 单套接字 Xeon 类 CPU
    • 100 GB 磁盘空间
  2. Install Red Hat Enterprise Linux 7.
  3. 允许系统访问 Operational Tools 软件包:

    1. 注册系统并订阅它:

      # subscription-manager register
      # subscription-manager list --consumed
      Copy to Clipboard Toggle word wrap

      如果没有自动附加 OpenStack 订阅,请参阅有关 手动附加订阅 的文档。

    2. 禁用初始启用的存储库,仅启用适合 Operational Tools 的仓库:

      # subscription-manager repos --disable=*
      # subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-7-server-optional-rpms --enable=rhel-7-server-openstack-8-optools-rpms
      Copy to Clipboard Toggle word wrap
      注意

      此节点上不能启用基础 OpenStack 存储库(rhel-7-server-openstack-8-rpms)。此软件仓库可能包含某些 Operational Tools 依赖项的较新版本,这些依赖项可能与 Operational Tools 软件包不兼容。

  4. 打开系统上的防火墙,以允许连接到 RabbitMQUchiwa

    # firewall-cmd --zone=public --add-port=5672/tcp --permanent
    # firewall-cmd --zone=public --add-port=3000/tcp --permanent
    # firewall-cmd --reload
    Copy to Clipboard Toggle word wrap
  5. 安装监控服务器所需的组件:

    # yum install sensu uchiwa redis rabbitmq-server
    Copy to Clipboard Toggle word wrap
  6. 配置 RabbitMQRedis,它们是 backbone 服务。启动 RedisRabbitMQ,并在引导时启用它们:

    # systemctl start redis
    # systemctl enable redis
    # systemctl start rabbitmq-server
    # systemctl enable rabbitmq-server
    Copy to Clipboard Toggle word wrap
  7. 使用可以访问主机的用户名和密码组合为 sensu 配置新的 RabbitMQ 虚拟主机:

    # rabbitmqctl add_vhost /sensu
    # rabbitmqctl add_user sensu sensu
    # rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"
    Copy to Clipboard Toggle word wrap
  8. 现在,基础服务正在运行并配置了 Sensu 监控服务器。使用以下内容创建 /etc/sensu/conf.d/rabbitmq.json

    {
      "rabbitmq": {
        "port": 5672,
        "host": "localhost",
        "user": "sensu",
        "password": "sensu",
        "vhost": "/sensu"
      }
    }
    Copy to Clipboard Toggle word wrap
  9. 接下来,使用以下内容创建 /etc/sensu/conf.d/redis.json

    {
      "redis": {
        "port": 6379,
        "host": "localhost"
      }
    }
    Copy to Clipboard Toggle word wrap
  10. 最后,使用以下内容创建 /etc/sensu/conf.d/api.json

    {
      "api": {
        "bind": "0.0.0.0",
        "port": 4567,
        "host": "localhost"
      }
    }
    Copy to Clipboard Toggle word wrap
  11. 启动并启用所有 Sensu 服务:

    # systemctl start sensu-server
    # systemctl enable sensu-server
    # systemctl start sensu-api
    # systemctl enable sensu-api
    Copy to Clipboard Toggle word wrap
  12. 配置 Uchiwa,这是 Sensu 的 Web 界面。要做到这一点,请编辑 /etc/uchiwa/uchiwa.json,并将其默认内容替换为以下内容:

    {
      "sensu": [
        {
          "name": "Openstack",
          "host": "localhost",
          "port": 4567
        }
      ],
      "uchiwa": {
        "host": "0.0.0.0",
        "port": 3000,
        "refresh": 5
      }
    }
    Copy to Clipboard Toggle word wrap
  13. 启动并启用 Uchiwa Web 界面:

    # systemctl start uchiwa
    # systemctl enable uchiwa
    Copy to Clipboard Toggle word wrap

3.2. 在所有节点上安装可用性监控代理

若要监控 OpenStack 环境中的所有系统,请在所有这些系统上运行以下命令:

  1. 启用 Operational Tools 存储库:

    # subscription-manager repos --enable=rhel-7-server-openstack-8-optools-rpms
    Copy to Clipboard Toggle word wrap
  2. 安装 Sensu:

    # yum install sensu
    Copy to Clipboard Toggle word wrap
  3. 配置 Sensu 代理。编辑 /etc/sensu/conf.d/rabbitmq.json 以包含以下内容;请记住,将 MONITORING_SERVER 替换为上一节中配置的监控服务器的主机名或 IP 地址:

    {
      "rabbitmq": {
        "port": 5672,
        "host": "MONITORING_SERVER",
        "user": "sensu",
        "password": "sensu",
        "vhost": "/sensu"
      }
    }
    Copy to Clipboard Toggle word wrap
  4. 编辑 /etc/sensu/conf.d/client.json 以包含以下内容;请记住,将 FQDN 替换为计算机的主机名,ADDRESS 替换为机器的公共 IP 地址:

    {
      "client": {
        "name": "FQDN",
        "address": "ADDRESS",
        "subscriptions": [ "all" ]
      }
    }
    Copy to Clipboard Toggle word wrap
  5. 最后,启动并启用 Sensu 客户端:

    # systemctl start sensu-client
    # systemctl enable sensu-client
    Copy to Clipboard Toggle word wrap

现在,您应能够访问在 http://MONITORING_SERVER:3000 中运行的 Uchiwa

第 4 章 安装性能监控套件

4.1. 安装集合聚合器/Relay

  1. 找到满足以下最低规格的裸机系统:

    • 4 GB 内存
    • 单套接字 Xeon 类 CPU
    • 500 GB 磁盘空间
  2. Install Red Hat Enterprise Linux 7.
  3. 允许系统访问 Operational Tools 软件包:

    1. 注册系统并订阅它:

      # subscription-manager register
      # subscription-manager list --consumed
      Copy to Clipboard Toggle word wrap

      如果没有自动附加 OpenStack 订阅,请参阅有关 手动附加订阅 的文档。

    2. 禁用初始启用的存储库,仅启用适合 Operational Tools 的仓库:

      # subscription-manager repos --disable=*
      # subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-7-server-optional-rpms --enable=rhel-7-server-openstack-8-optools-rpms
      Copy to Clipboard Toggle word wrap
      注意

      此节点上不能启用基础 OpenStack 存储库(rhel-7-server-openstack-8-rpms)。此软件仓库可能包含某些 Operational Tools 依赖项的较新版本,这些依赖项可能与 Operational Tools 软件包不兼容。

  4. 在系统上打开防火墙,以允许连接到 GraphiteGrafana

    # firewall-cmd --zone=public --add-port=2003/tcp --permanent
    # firewall-cmd --zone=public --add-port=3030/tcp --permanent
    # firewall-cmd --reload
    Copy to Clipboard Toggle word wrap
  5. 完成后,运行以下命令来安装 GraphiteGrafana 软件:

    # yum install python-carbon graphite-web grafana httpd
    Copy to Clipboard Toggle word wrap
  6. 配置 Grafana Web 界面以允许访问。编辑 /etc/httpd/conf.d/graphite-web.conf 并修改 Require 行,如下所示:

    ...
    <Directory "/usr/share/graphite/">
        <IfModule mod_authz_core.c>
            # Apache 2.4
            Require all granted
        </IfModule>
    ...
    Copy to Clipboard Toggle word wrap
  7. 编辑 /etc/grafana/grafana.ini,并将 http_port 更改为 3030
  8. 同步 Graphite Web 后面的数据库。运行以下命令;当提示您创建超级用户时,选择 no:

    # sudo -u apache /usr/bin/graphite-manage syncdb --noinput
    Copy to Clipboard Toggle word wrap
  9. 启动并启用所有 GraphiteGrafana 服务:

    # systemctl start httpd
    # systemctl enable httpd
    # systemctl start carbon-cache
    # systemctl enable carbon-cache
    # systemctl start grafana-server
    # systemctl enable grafana-server
    Copy to Clipboard Toggle word wrap
  10. Grafana 配置为与您的 Graphite 实例通信:

    1. 前往 http://PERFORMANCE_MONITORING_HOST:3030/.您应该会看到 Grafana 登录页面。
    2. 输入 admin/admin 的默认凭据来登录到系统。
    3. 登录后,点屏幕左上角的 Grafana 徽标,然后选择 Data Sources
    4. 在页面顶部,点 Add new 并输入以下详情:

      Expand

      Name

      Graphite

      default

      是(选择)

      类型

      Graphite

      URL

      http://localhost/

      权限

      proxy

      基本验证

      否(未选中)

    5. 最后,单击底部的 Add 按钮。

4.2. 在所有节点上安装性能监控集合代理

若要监控 OpenStack 环境中所有系统的性能,请在所有这些系统上运行以下命令:

  1. 启用 Operational Tools 存储库:

    # subscription-manager repos --enable=rhel-7-server-openstack-8-optools-rpms
    Copy to Clipboard Toggle word wrap
  2. 安装 collectd

    # yum install collectd
    Copy to Clipboard Toggle word wrap
  3. 配置 collectd,以将数据发送到性能监控聚合器/重新生成。为此,请使用以下内容创建 /etc/collectd.d/10-write_graphite.conf,其中 PERFORMANCE_MONITORING_HOST 是之前配置为监控聚合器/relay 的主机的主机名称或 IP 地址:

    <LoadPlugin write_graphite>
      Globals false
    </LoadPlugin>
    
    <Plugin write_graphite>
      <Carbon>
        Host "PERFORMANCE_MONITORING_HOST"
        Port "2003"
        Prefix "collectd."
        EscapeCharacter "_"
        StoreRates true
        LogSendErrors true
        Protocol "tcp"
      </Carbon>
    </Plugin>
    Copy to Clipboard Toggle word wrap
  4. 如果您使用 SELinux,请 collectd 到 tcp 网络连接:

    # setsebool -P collectd_tcp_network_connect=1
    Copy to Clipboard Toggle word wrap
  5. 启动并启用 collectd

    # systemctl start collectd
    # systemctl enable collectd
    Copy to Clipboard Toggle word wrap

片刻后,您应该会在在 http://PERFORMANCE_MONITORING_HOST:3030/ 运行的 Graphite Web 用户界面中看到指标。

法律通告

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat