186.md 2.4 KB
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
# Monitoring AWS Resources

> 原文:[https://docs.gitlab.com/ee/user/project/integrations/prometheus_library/cloudwatch.html](https://docs.gitlab.com/ee/user/project/integrations/prometheus_library/cloudwatch.html)

*   [Requirements](#requirements)
*   [Metrics supported](#metrics-supported)
*   [Configuring Prometheus to monitor for Cloudwatch metrics](#configuring-prometheus-to-monitor-for-cloudwatch-metrics)
*   [Specifying the Environment label](#specifying-the-environment-label)

# Monitoring AWS Resources[](#monitoring-aws-resources "Permalink")

在 GitLab 9.4 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/12621)

GitLab 支持从[Elastic Load Balancer](https://aws.amazon.com/elasticloadbalancing/)开始自动检测和监视 AWS 资源. 这是通过利用官方[Cloudwatch 导出程序提供的](https://github.com/prometheus/cloudwatch_exporter) ,该程序将[Cloudwatch 指标](https://aws.amazon.com/cloudwatch/)转换为 Prometheus 可读形式.

## Requirements[](#requirements "Permalink")

必须启用[Prometheus 服务](../prometheus.html) .

## Metrics supported[](#metrics-supported "Permalink")

| Name | Query |
| --- | --- |
| 吞吐量(要求/秒) | `sum(aws_elb_request_count_sum{%{environment_filter}}) / 60` |
| 延迟(毫秒) | `avg(aws_elb_latency_average{%{environment_filter}}) * 1000` |
| HTTP 错误率(%) | `sum(aws_elb_httpcode_backend_5_xx_sum{%{environment_filter}}) / sum(aws_elb_request_count_sum{%{environment_filter}})` |

## Configuring Prometheus to monitor for Cloudwatch metrics[](#configuring-prometheus-to-monitor-for-cloudwatch-metrics "Permalink")

要开始使用 Cloudwatch 监控,您应该安装和配置[Cloudwatch 导出程序](https://github.com/prometheus/cloudwatch_exporter) ,该程序可检索和解析指定的 Cloudwatch 指标并将其转换为 Prometheus 监控端点.

目前,唯一受支持的 AWS 资源是 Elastic Load Balancer,其 Cloudwatch 指标在[此处记录](https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-cloudwatch-metrics.html) .

样品的 CloudWatch 导出配置文件,配置用于基本 AWS ELB 监测,是[可供下载](../samples/cloudwatch.yml) .

## Specifying the Environment label[](#specifying-the-environment-label "Permalink")

为了隔离并仅显示给定环境的相关指标,GitLab 需要一种方法来检测关联了哪些标签. 为此,GitLab 将[查找`environment`标签](index.html#identifying-environments) .