Amazon web services 通知警报:超出上下文截止日期(可能存在代理问题)
我正在尝试将EC2 AWS中ubuntu上的Alermanager服务器连接到Slack,但我发现此错误:Amazon web services 通知警报:超出上下文截止日期(可能存在代理问题),amazon-web-services,amazon-ec2,proxy,prometheus-alertmanager,Amazon Web Services,Amazon Ec2,Proxy,Prometheus Alertmanager,我正在尝试将EC2 AWS中ubuntu上的Alermanager服务器连接到Slack,但我发现此错误: Apr 14 18:22:26 prometheus-db-v01-01a.myserver.com alertmanager[5854]: level=error ts=2019-04-14T18:22:26.658601495Z caller=dispatch.go:177 component=dispatcher msg="Notify for alerts failed" num_
Apr 14 18:22:26 prometheus-db-v01-01a.myserver.com alertmanager[5854]: level=error ts=2019-04-14T18:22:26.658601495Z caller=dispatch.go:177 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="Post <redacted>: context deadline exceeded"
我可以看到警报通过以下方式触发我的测试警报:
root@prometheus-db-v01-01a:~# amtool alert --alertmanager.url=http://localhost:9093 -v
Alertname Starts At Summary
Cassandra_yellow 2019-04-14 18:11:56 UTC The cassandra cluster is in yellow state
我用systemd启动了普罗米修斯:
root@prometheus-db-v01-01a:~# cat /etc/systemd/system/alertmanager.service
[Unit]
Description=Prometheus Alertmanager Service
Wants=network-online.target
After=network.target
[Service]
Environment=https_proxy=http://proxy:80/
Environment=http_proxy=http://proxy:80/
User=alertmanager
Group=alertmanager
Type=simple
ExecStart=/usr/local/bin/alertmanager \
--config.file /etc/alertmanager/alertmanager.yml \
--storage.path /var/lib/alertmanager/data
Restart=always
[Install]
WantedBy=multi-user.target
root@prometheus-db-v01-01a:~#
我尝试用2环境变量设置代理,但结果相同
服务器使用代理与Slack通信,我可以通过以下方式进行测试:
root@prometheus-db-v01-01a:~# curl -X POST --data-urlencode "payload={\"channel\": \"#errors\", \"username\": \"webhookbot\", \"text\": \"This is posted to #errors and comes from a bot named webhookbot.\", \"icon_emoji\": \":ghost:\"}" https://hooks.slack.com/services/ID
这是可行的,而
root@prometheus-db-v01-01a:~# curl -X POST --noproxy "*" --data-urlencode "payload={\"channel\": \"#errors\", \"username\": \"webhookbot\", \"text\": \"This is posted to #errors and comes from a bot named webhookbot.\", \"icon_emoji\": \":ghost:\"}" https://hooks.slack.com/services/ID
curl: (7) Failed to connect to hooks.slack.com port 443: Connection timed out
以上所有命令都来自alertmanger服务器
我认为这是代理问题,对吗?我如何设置它
提前感谢问题已解决:它是代理,需要在alertmanager.yml
文件中设置
templates:
- '/etc/alertmanager/template/slack.tmpl'
global:
http_config:
proxy_url: 'http://proxy:80/'
route:
receiver: slack_general
repeat_interval: 5m
group_by: [alertname]
routes:
- match:
severity: minor
receiver: slack_general
receivers:
- name: slack_general
slack_configs:
[...]
templates:
- '/etc/alertmanager/template/slack.tmpl'
global:
http_config:
proxy_url: 'http://proxy:80/'
route:
receiver: slack_general
repeat_interval: 5m
group_by: [alertname]
routes:
- match:
severity: minor
receiver: slack_general
receivers:
- name: slack_general
slack_configs:
[...]