代码之家  ›  专栏  ›  技术社区  ›  JayMore

在CloudWatch仪表板中查看CloudFront指标

  •  4
  • JayMore  · 技术社区  · 7 年前

    是否有办法在现有CloudWatch仪表板中显示CloudFront指标?

    我可以在CloudFront控制台中查看CloudFront分发指标(总请求、命中率…)但我在CloudWatch仪表盘中找不到这些指标。

    在Cloudfront文档上( https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cf-metricscollected.html )他们讨论了“AWS/CloudFront”名称空间,但CloudWatch中没有附加到此名称空间的度量。

    此外,我怀疑有一个选项可以启用度量(比如从S3获得详细统计数据),但我没有找到这样的选项。

    我更喜欢将所有指标放在一个仪表板中,这样更容易交叉数据(例如EC2 cpu利用率与数据库连接与cloudwatch请求)。

    2 回复  |  直到 7 年前
        1
  •  11
  •   noetix    6 年前

    尝试查看区域 us-east-1 。您只能在那里找到它们,因为所有CloudFront发行版都位于 us-east-1

    从那里,您可以将它们添加到仪表板;)

        2
  •  0
  •   Piyush Sonigra    5 年前

    您可以编写cloudwatch仪表板模板,并提供该资源中的可用区域。

    enter image description here

    下面是一个示例模板,其中区域根据资源的不同而不同。

    您可以根据需要设置x、y、宽度和高度。

    ``

    {
        "widgets": [
            {
                "type": "text",
                "x": 0,
                "y": 0,
                "width": 24,
                "height": 2,
                "properties": {
                    "markdown": "\n# Resource Monitoring\n"
                }
            },
            {
                "type": "metric",
                "x": 16,
                "y": 2,
                "width": 8,
                "height": 5,
                "properties": {
                    "metrics": [
                        [ "AWS/ApiGateway", "Count", "ApiName", "ApiGateway_name", { "stat": "SampleCount", "id": "m0r0" } ]
                    ],
                    "region": "ap-southeast-1",
                    "title": "Count",
                    "legend": {
                        "position": "right"
                    },
                    "copilot": true
                }
            },
            {
                "type": "metric",
                "x": 0,
                "y": 31,
                "width": 12,
                "height": 5,
                "properties": {
                    "metrics": [
                        [ "AWS/CloudFront", "Requests", "DistributionId", "gfajshgjk", "Region", "Global", { "stat": "Sum", "id": "m0r0", "label": "cf_name" } ]
                    ],
                    "region": "us-east-1",
                    "title": "Requests",
                    "copilot": true
                }
            }
        ]
    }
    

    ``