Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

利用腾讯云自定义告警实现免费短信通知 #87

Closed
iLayPark opened this issue May 15, 2023 · 14 comments
Closed

利用腾讯云自定义告警实现免费短信通知 #87

iLayPark opened this issue May 15, 2023 · 14 comments
Labels
enhancement New feature or request

Comments

@iLayPark
Copy link

iLayPark commented May 15, 2023

参考 https://blog.craftyun.cn/post/165.html

@songquanpeng
Copy link
Owner

这个有意思。

@songquanpeng songquanpeng added the enhancement New feature or request label May 15, 2023
@songquanpeng
Copy link
Owner

API Explorer:https://console.cloud.tencent.com/api/explorer?Product=monitor&Version=2018-07-24&Action=SendCustomAlarmMsg

调用这个需要账号的 Access Token,但是我没找到给子账号设置什么样的对应的最小权限来调用该 API。

@iLayPark
Copy link
Author

{
    "version": "2.0",
    "statement": [
        {
            "effect": "allow",
            "action": [
                "monitor:SendCustomAlarmMsg"
            ],
            "resource": [
                "*"
            ]
        }
    ]
}

这个策略应该可以

@iLayPark
Copy link
Author

{
    "version": "2.0",
    "statement": [
        {
            "effect": "allow",
            "action": [
                "monitor:SendCustomAlarmMsg"
            ],
            "resource": [
                "*"
            ]
        }
    ]
}

这个策略应该可以

用API Explorer签名串生成测试了一下是可以的

@songquanpeng
Copy link
Owner

songquanpeng commented May 15, 2023

我调通了,总结一下。

  1. 新建用户
    1. 自定义创建
    2. 可访问资源并接收消息
    3. 填写用户信息(填写手机号),选中编程访问
  2. 新建自定义策略->按策略生成器创建->JSON,填入以下 JSON -> 关联用户。
{
    "version": "2.0",
    "statement": [
        {
            "effect": "allow",
            "action": [
                "monitor:SendCustomAlarmMsg"
            ],
            "resource": [
                "*"
            ]
        }
    ]
}
  1. 回到用户创建流程,直接下一步 & 下一步,保存密钥信息。
  2. 手机上收到确认短信,点击验证。
  3. 新建用户组,把新用户拉入用户组。
  4. 新增消息策略,选择刚刚创建的用户组。

@songquanpeng
Copy link
Owner

已实现,已推送 v0.4.9-alpha

不过现在我测试发现没有收到消息,刚刚是可以的,也没有报错,可能是腾讯云的服务抽风了,明天再试一下。

image

@songquanpeng
Copy link
Owner

是我不小心把渠道删了,程序是没问题的:
image

@Ahorace
Copy link

Ahorace commented May 16, 2023

配置参数中的消息策略 ID和区域在哪里获取,未找到位置

@songquanpeng
Copy link
Owner

配置参数中的消息策略 ID和区域在哪里获取,未找到位置

消息策略:https://console.cloud.tencent.com/monitor/message

区域的话,https://console.cloud.tencent.com/api/explorer?Product=monitor&Version=2018-07-24&Action=SendCustomAlarmMsg

image

@Ahorace
Copy link

Ahorace commented May 24, 2023

现在使用腾讯短息报错,(-503)请求参数有误。
消息如下:
{"message":"(-503)请求参数有误。","success":false}

@songquanpeng
Copy link
Owner

确实,不会 API 这么快就变了吧。。。

@songquanpeng songquanpeng reopened this May 24, 2023
@songquanpeng
Copy link
Owner

最近一两周会比较忙,需要等忙完才能处理。

@Think-Me
Copy link

都散了吧!!!客服说这个功能下线了。。。
image

@songquanpeng
Copy link
Owner

吐了,原来真的是 API 变了,白适配了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

3 participants