WwanjunleiK零S
notification manager没收到消息,问题应该是出在am那边,你重启下am,把全部的日志贴下
notification manager没收到消息,问题应该是出在am那边,你重启下am,把全部的日志贴下
wanjunlei
我在ui界面重新部署了下alertmanager,日志如下:
# kubectl logs --tail 500 alertmanager-main-0 -n kubesphere-monitoring-system -c alertmanager
level=info ts=2021-03-11T07:58:45.069Z caller=main.go:216 msg="Starting Alertmanager" version="(version=0.21.0, branch=HEAD, revision=4c6c03ebfe21009c546e4d1e9b92c371d67c021d)"
level=info ts=2021-03-11T07:58:45.069Z caller=main.go:217 build_context="(go=go1.14.4, user=root@dee35927357f, date=20200617-08:54:02)"
level=info ts=2021-03-11T07:58:45.477Z caller=coordinator.go:119 component=configuration msg="Loading configuration file" file=/etc/alertmanager/config/alertmanager.yaml
level=info ts=2021-03-11T07:58:45.562Z caller=coordinator.go:131 component=configuration msg="Completed loading of configuration file" file=/etc/alertmanager/config/alertmanager.yaml
level=info ts=2021-03-11T07:58:45.664Z caller=main.go:485 msg=Listening address=:9093
https://github.com/kubesphere/notification-manager/tree/release-0.6/pkg/webhook/testdata
这是nm的测试数据,你直接调用http://notification-manager-svc.kubesphere-monitoring-system.svc:19093/api/v2/alerts发送数据试试
有没有收到通知?nm的日志贴下
这样是不是说am到nm是没有问题的吧,是nm到微信是不通的?
你把notification manager升级到0.7.0试试
你确认下日志级别是不是debug
我发现升级nm到0.7时,出现个奇怪的现象:nm能apply创建成功,但是kubectl get pod -n xxx时竟然没有,什么错误信息都没有~
看看notification manager operator的日志吧
nm有报错吗?
wanjunlei
我当前使用的版本是0.7.0~
我在终端执行:
# curl -X POST -H "Content-Type: application/json" -d @test02.json http://notification-manager-svc.kubesphere-monitoring-system.svc:19093/api/v2/alerts
nm的日志:
level=debug ts=2021-03-11T17:45:46.091975534+08:00 caller=handler.go:63 msg="Acquired worker queue lock..."
level=debug ts=2021-03-11T17:45:46.09207367+08:00 caller=handler.go:214 msg="Notification request accepted"
level=debug ts=2021-03-11T17:45:46.09211236+08:00 caller=handler.go:159 msg="Begins to send notification..."
level=debug ts=2021-03-11T17:45:46.092926795+08:00 caller=handler.go:142 msg="Worker: notification sent"
level=debug ts=2021-03-11T17:45:46.092977108+08:00 caller=handler.go:150 msg="Worker: exiting"
level=debug ts=2021-03-11T17:45:46.092991445+08:00 caller=handler.go:153 msg="Worker: exit"
level=debug ts=2021-03-11T17:45:46.093001959+08:00 caller=handler.go:176 msg="Worker exit after 812.211µs"
wanjunlei
我在ui上创建/删除cm,nm能打印出响应的信息,但是微信没有收到~
level=info ts=2021-03-11T17:48:28.740767061+08:00 caller=config.go:677 msg="resource change" op=add type=wechat name=global-wechat-receiver namespace=kubesphere-monitoring-system
level=debug ts=2021-03-11T17:48:35.013114851+08:00 caller=handler.go:63 msg="Acquired worker queue lock..."
level=debug ts=2021-03-11T17:48:35.013443668+08:00 caller=handler.go:214 msg="Notification request accepted"
level=debug ts=2021-03-11T17:48:35.013744399+08:00 caller=handler.go:159 msg="Begins to send notification..."
level=debug ts=2021-03-11T17:48:35.01458076+08:00 caller=handler.go:142 msg="Worker: notification sent"
level=debug ts=2021-03-11T17:48:35.014787087+08:00 caller=handler.go:150 msg="Worker: exiting"
level=debug ts=2021-03-11T17:48:35.014936298+08:00 caller=handler.go:153 msg="Worker: exit"
level=debug ts=2021-03-11T17:48:35.015021244+08:00 caller=handler.go:176 msg="Worker exit after 1.168177ms"
level=debug ts=2021-03-11T17:49:11.074751414+08:00 caller=handler.go:63 msg="Acquired worker queue lock..."
level=debug ts=2021-03-11T17:49:11.07485059+08:00 caller=handler.go:214 msg="Notification request accepted"
level=debug ts=2021-03-11T17:49:11.075250662+08:00 caller=handler.go:159 msg="Begins to send notification..."
level=debug ts=2021-03-11T17:49:11.076171668+08:00 caller=handler.go:142 msg="Worker: notification sent"
level=debug ts=2021-03-11T17:49:11.076350858+08:00 caller=handler.go:150 msg="Worker: exiting"
level=debug ts=2021-03-11T17:49:11.076455036+08:00 caller=handler.go:153 msg="Worker: exit"
level=debug ts=2021-03-11T17:49:11.076556322+08:00 caller=handler.go:176 msg="Worker exit after 1.108427ms"
你这是没有找到receiver,你检查你的receiver和config的crd,看看有没有问题,需要是global的receiver和default的config
wanjunlei
我就按照官网上写的:
Deploy the default WechatConfig and a global WechatReceivers:
cat <<EOF | kubectl apply -f -
apiVersion: notification.kubesphere.io/v1alpha1
kind: WechatConfig
metadata:
name: default-wechat-config
namespace: kubesphere-monitoring-system
labels:
app: notification-manager
type: default
spec:
wechatApiUrl: < wechat-api-url >
wechatApiSecret:
key: wechat
name: < wechat-api-secret >
wechatApiCorpId: < wechat-api-corp-id >
wechatApiAgentId: < wechat-api-agent-id >
---
apiVersion: notification.kubesphere.io/v1alpha1
kind: WechatReceiver
metadata:
name: global-wechat-receiver
namespace: kubesphere-monitoring-system
labels:
app: notification-manager
type: global
spec:
# wechatConfigSelector needn't to be configured for a global receiver
# optional
# One of toUser, toParty, toParty should be specified.
toUser: < wechat-user >
toParty: < wechat-party >
toTag: < wechat-tag >
---
apiVersion: v1
data:
wechat: dGVzdA==
kind: Secret
metadata:
labels:
app: notification-manager
name: < wechat-api-secret >
namespace: kubesphere-monitoring-system
type: Opaque
EOF
toUser: < wechat-user >这个地方我写的是wechatApiCorpId