is-a-gamer

Results 9 comments of is-a-gamer

在配置文件中这样配置 prometheus-webhook-dingtalk.yml ```yaml targets: webhook: url: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxxxxxxx secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx template: dingtalk-message.tmpl ``` 启动prometheus-webhook-dingtalk加上参数 ```shell /usr/local/bin/prometheus-webhook-dingtalk --config.file=prometheus-webhook-dingtalk/prometheus-webhook-dingtalk.yml --web.enable-lifecycle ``` 之后你应该可以在日志中看到 ```shell Jun 10 09:47:11 192-168-1-xxx prometheus-webhook-dingtalk[20176]: level=info ts=2020-06-10T01:47:11.122Z caller=main.go:117 component=configuration msg="Loading...

例 ``` template: /etc/prometheus/templates/dingtalk-message.tmpl template: templates/dingtalk-message.tmpl ``` 如果提示模板文件格式错误,先检查模板文件 可以使用default.tmpl尝试去启动 在prometheus-webhook-dingtalk里面配置了tmpl模板之后,通过prometheus-webhook-dingtalk发送到钉钉信息,模板采用的应该是prometheus-webhook-dingtalk的

如果仍然是默认的信息格式的话 请重新拉取代码并重新构建 约40分钟前有一个"When specifying a template, the default template is no longer used"的合并 修复了不能使用自定义模板的BUG

之前版本启动正常是因为实际上加载的是"default.tmpl",而现在代码已经修正,会加载你指定的模板文件,所以实际上你的配置文件还是不正确的 你可以试着在模板中加上这一行 (在上面看到了你已经定义了"__subject") ``` {{ define "ding.link.title" }}{{ template "__subject" . }}{{ end }} ```

那我们来试试最简单的 ``` {{ define "ding.link.title" }}测试标题{{ end }} {{ define "ding.link.content" }}测试内容{{ end }} ``` 这个时候你的钉钉消息应该只会显示"测试内容"

项目早已暂停, B站官方SDK也已经支持Unity,此项目将存档,如有类似需求,请前往 [哔哩哔哩直播开放平台](https://open-live.bilibili.com/) 查看 [SDK For Unity](https://open-live.bilibili.com/document/cca272c5-e49d-6bea-0fbe-23c37288a08a)

项目早已暂停, B站官方SDK也已经支持Unity,此项目将存档,如有类似需求,请前往 [哔哩哔哩直播开放平台](https://open-live.bilibili.com/) 查看 [SDK For Unity](https://open-live.bilibili.com/document/cca272c5-e49d-6bea-0fbe-23c37288a08a)