Amazon web services Can';我的普罗米修斯和格拉法纳部署在AWS弹性豆茎码头
我想用Prometheus和Grafana监控我的应用程序,它们在AWS Elastic Beanstalk的Docker中运行,但在正确部署它时遇到问题 这是我的Amazon web services Can';我的普罗米修斯和格拉法纳部署在AWS弹性豆茎码头,amazon-web-services,docker,grafana,prometheus,amazon-elastic-beanstalk,Amazon Web Services,Docker,Grafana,Prometheus,Amazon Elastic Beanstalk,我想用Prometheus和Grafana监控我的应用程序,它们在AWS Elastic Beanstalk的Docker中运行,但在正确部署它时遇到问题 这是我的dockrun.aws.json: { "AWSEBDockerrunVersion": "2", "volumes": [ { "name": "prometheus-conf", "host": { "sourcePath": "/var/app/current/promet
dockrun.aws.json
:
{
"AWSEBDockerrunVersion": "2",
"volumes": [
{
"name": "prometheus-conf",
"host": {
"sourcePath": "/var/app/current/prometheus"
}
}
],
"containerDefinitions": [
{
"name": "prometheus-app",
"image": "prom/prometheus",
"essential": true,
"memory": 512,
"portMappings": [
{
"hostPort": 9090,
"containerPort": 9090
}
],
"mountPoints": [
{
"sourceVolume": "prometheus-conf",
"containerPath": "/opt/prometheus"
}
],
"command": [
"--config.file=/opt/prometheus/prometheus.yml"
]
},
{
"name": "grafana",
"image": "grafana/grafana",
"essential": true,
"memory": 256,
"links": [
"prometheus-app"
],
"portMappings": [
{
"hostPort": 3000,
"containerPort": 3000
}
]
}
]
}
这是我在prometheus
文件夹中的prometheus.yml
:
global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
scrape_configs:
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'jParser'
static_configs:
- targets: ['jParser.fpemryt2er.us-east-2.elasticbeanstalk.com']
当我在eb cli
中使用eb local run
本地运行它时,一切正常,我可以在localhost:9090
上访问prometheus,在localhost:3000
上访问grafana
当我使用eb deploy
将其部署到AWS Elastic Beanstalk时,该过程成功结束,我可以在仪表板中看到该实例,但在一分钟内状态OK
切换到Severe
,并显示消息环境健康已从OK过渡到Severe。ELB运行状况失败或不适用于所有实例。
和100.0%的ELB请求使用HTTP 5xx失败(10分钟前)
:
但当我在EC2管理控制台中查看该实例时,它显示该实例正在运行,没有任何问题:
在我的任务定义控制台中,我还可以看到普罗米修斯和格拉法纳毫无问题地运行:
但无论如何,我无法通过键入EB url+:port提供的信息联系到普罗米修斯和格拉法纳,例如:jd env.8myne2inmq.us-west-2.elasticbeanstalk.com:9090
。我还尝试使用EC2控制台中显示的公共DNS和IP,但它也不起作用
在我的loadbalancer中,我打开了端口9090和3000:
请帮助我使这些应用程序正常工作。我发现了问题。在Loadbalancer中打开端口
9090
和3000
后,还需要在Configurations/Instances/
中切换EC2安全组。之后,这些端口打开的新负载平衡配置将可用
还有一个问题是Elastic beanstalk health monitoring system试图检查端口80
,但在我的例子中,没有任何端口,因此health status始终为红色。在Configurations/Monitoring
中,我将其更改为endpointHTTP:9090/graph
——现在它访问普罗米修斯主页,健康状况为绿色