从 github 链接克隆源并导入。
git clone https://github.com/JangGyeongSik/gcp-teams-monitoring.git
之后,通过附加链接创建 Teams Webhook。
https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?WT.mc_id=m365-12509-rwilliams https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?WT.mc_id=m365-12509-rwilliams
按如下方式编辑 .env.yaml 文件。
TEAMS_WEBHOOK_URL 是之前发布的 URL。
AUTH_TOKEN 指定任意值。
TEAMS_WEBHOOK_URL: [TEAMS_WEBHOOK_URL]
AUTH_TOKEN: gyeongsik_jang
然后,通过下面的ShellFile部署云函数。
对于服务帐户,您必须提前获得以下权限。
gcloud functions deploy gcp-monitoring-teams-trigger \
--entry-point=F \
--memory=128MB \
--region=asia-northeast3 \
--runtime=go113 \
--env-vars-file=env.yaml \
--trigger-http \
--timeout=10s \
--service-account=[SERVICE_ACCOUNT]
创建生成的触发器 URL 作为监控通知通道,如下所示。
应在 URL 末尾输入 Auth_Token 值。
https://[Cloud_Function_Trigger_URL]?auth_token=gyeongsik_jang
With this setup, you can check the Test Connection in Teams as follows.
感谢您阅读这么长的帖子。
张庆植