Configuring a Monitoring node for Scaling and High Availability

原文:https://docs.gitlab.com/ee/administration/high_availability/monitoring_node.html

Configuring a Monitoring node for Scaling and High Availability

在 GitLab 12.0 中引入 .

您可以配置 Prometheus 节点以监视 GitLab.

Standalone Monitoring node using Omnibus GitLab

Omnibus GitLab 软件包可用于配置运行PrometheusGrafana的独立 Monitoring 节点. 监视节点不是高度可用. 请参阅缩放和高可用性的 GitLab 扩展和高可用性选项的概述.

以下步骤是使用 Omnibus 配置运行 Prometheus 和 Grafana 的 Monitoring 节点的最低必需步骤:

  1. SSH 进入”监视”节点.
  2. 从 GitLab 下载页面使用步骤 1 和 2 下载/安装所需的 Omnibus GitLab 软件包.
    • 不要完成下载页面上的任何其他步骤.
  3. CONSUL_SERVER_NODES ,请确保收集CONSUL_SERVER_NODES ,它们是 Consul 服务器节点的 IP 地址或 DNS 记录. 请注意,它们显示为YYYY consul1.gitlab.example.com ZZZZ

  4. 编辑/etc/gitlab/gitlab.rb并添加内容:

    1. external_url 'http://gitlab.example.com'
    2. # Enable Prometheus
    3. prometheus['enable'] = true
    4. prometheus['listen_address'] = '0.0.0.0:9090'
    5. prometheus['monitor_kubernetes'] = false
    6. # Enable Login form
    7. grafana['disable_login_form'] = false
    8. # Enable Grafana
    9. grafana['enable'] = true
    10. grafana['admin_password'] = 'toomanysecrets'
    11. # Enable service discovery for Prometheus
    12. consul['enable'] = true
    13. consul['monitoring_service_discovery'] = true
    14. # Replace placeholders
    15. # Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z
    16. # with the addresses of the Consul server nodes
    17. consul['configuration'] = {
    18. retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z),
    19. }
    20. # Disable all other services
    21. gitlab_rails['auto_migrate'] = false
    22. alertmanager['enable'] = false
    23. gitaly['enable'] = false
    24. gitlab_exporter['enable'] = false
    25. gitlab_workhorse['enable'] = false
    26. nginx['enable'] = true
    27. postgres_exporter['enable'] = false
    28. postgresql['enable'] = false
    29. redis['enable'] = false
    30. redis_exporter['enable'] = false
    31. sidekiq['enable'] = false
    32. puma['enable'] = false
    33. node_exporter['enable'] = false
    34. gitlab_exporter['enable'] = false
  5. 运行sudo gitlab-ctl reconfigure来编译配置.

下一步是告诉所有其他节点监视节点在哪里:

  1. 编辑/etc/gitlab/gitlab.rb ,然后添加或查找并取消注释以下行:

    1. gitlab_rails['prometheus_address'] = '10.0.0.1:9090'

    其中10.0.0.1:9090是 Prometheus 节点的 IP 地址和端口.

  2. 保存文件并重新配置 GitLab,以使更改生效.

Migrating to Service Discovery

使用consul['monitoring_service_discovery'] = true启用使用服务发现进行consul['monitoring_service_discovery'] = true ,请确保未在/etc/gitlab/gitlab.rb设置prometheus['scrape_configs'] . 在/etc/gitlab/gitlab.rb同时设置consul['monitoring_service_discovery'] = trueprometheus['scrape_configs']都会导致错误.