[Question] <title>默认部署后,阿里云短信发送失败
Question
默认部署后的几个问题:
- 短信模板是否只能用一个,不能更换,不能每个项目用独立的模板吗?
- 为什么在配置完阿里云的ak及短信模板code等信息后,通知媒介添加接收对象时候,测试总是失败,报错“模板变量JSON格式错误 或 JSON变量属性与模板占位符不一致”
- 文档中关于短信通知配置方式很难看懂,并且给出的短信模板压根不对,阿里云的占位符应该是${xxx},但是文档给的是 监控项:
instance,告警级别:priority。内容:content这里我按照阿里云的格式配置完还是不能用。 我怀疑不是占位符的问题,应该是content或者哪个属性没有值造成的异常,这种测试发送应该可以手动输入三个占位符的值才对。
Looked into the three points here:
2 & 3 are bugs — fix submitted in #4331. The test-send alert carries no instance value, so HertzBeat sends {"instance":null,...} as the template param and Aliyun rejects every test send with exactly the error you quoted (模板变量JSON格式错误 或 JSON变量属性与模板占位符不一致) — your guess that some attribute had no value was right. The docs were also wrong: the template example used backticks, while Aliyun placeholders are ${...} — the template must declare exactly ${instance} ${priority} ${content}, no more, no less. Both are fixed in the PR.
1 (per-rule SMS template) is a feature request — today one global template-code serves all rules. Worth its own issue so it does not get lost when this one closes; feel free to open one (or I can).