amazon-web-services - 在 Grafana 中监控 Amazon EC2 API 请求
问题描述
我无法使用 Grafana 在 EC2 实例中提取 Amazon Cloudwatch 指标。设置如下:
带有 Grafana 的 EC2 实例:
- 安全组:(ssh,tpc,22,0.0.0.0/0;自定义tcp,tpc,3000,0.0.0.0/0;)
- 使用 Grafana 附加到 EC2 实例中的角色的策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowReadingMetricsFromCloudWatch",
"Effect": "Allow",
"Action": [
"cloudwatch:DescribeAlarmsForMetric",
"cloudwatch:DescribeAlarmHistory",
"cloudwatch:DescribeAlarms",
"cloudwatch:ListMetrics",
"cloudwatch:GetMetricStatistics",
"cloudwatch:GetMetricData"
],
"Resource": "*"
},
{
"Sid": "AllowReadingLogsFromCloudWatch",
"Effect": "Allow",
"Action": [
"logs:DescribeLogGroups",
"logs:GetLogGroupFields",
"logs:StartQuery",
"logs:StopQuery",
"logs:GetQueryResults",
"logs:GetLogEvents"
],
"Resource": "*"
},
{
"Sid": "AllowReadingTagsInstancesRegionsFromEC2",
"Effect": "Allow",
"Action": [
"ec2:DescribeTags",
"ec2:DescribeInstances",
"ec2:DescribeRegions"
],
"Resource": "*"
},
{
"Sid": "AllowReadingResourcesForTags",
"Effect": "Allow",
"Action": "tag:GetResources",
"Resource": "*"
}
]
}
没有检索任何数据的 Grafana 查询截图:
解决方案
我终于可以通过将命名空间更改为 AWS/ElasticBeanstalk 并将具有 EnvironmentName 的维度更改为我想要定位的对象来提取一些数据。在我必须转到 Elasticbeanstalk 的配置仪表板并在输入选择中的 CloudWatch 自定义指标中添加适当的指标之前