Skip to content

关于无法触发tg警告 #60

@lls275

Description

@lls275

我的配置文件上,配置了tg的信息,并开启了推送功能,但无法推送!

notify_interval = 30
# https://core.telegram.org/bots/api
# https://jinja.palletsprojects.com/en/3.0.x/templates/#if
[tgbot]
enabled = true
bot_token = "2xxxx67783:AAF4eCz9XMm-TSnI0xxxxxxxx7WYOEAgxqw"
chat_id = "88xxxx680"
# host 可用字段参见 payload.rs 文件 HostStat 结构, {{host.xxx}} 为占位变量
# 例如 host.name 可替换为 host.alias,大家根据喜好来编写通知消息
title = "❗<b>Server Status</b>"
online_tpl =  "{{config.title}} \n😆 {{host.location}} {{host.name}} 主机恢复上线啦"
offline_tpl = "{{config.title}} \n😱 {{host.location}} {{host.name}} 主机已经掉线啦"
# custom 模板置空则停用自定义告警,只保留上下线通知
custom_tpl = """
{% if host.memory_used / host.memory_total > 0.5  %}
<pre>😲 {{host.name}} 主机内存使用率超50%, 当前{{ (100 * host.memory_used / host.memory_total) | round }}%  </pre>
{% endif %}

{% if host.hdd_used / host.hdd_total  > 0.5  %}
<pre>😲 {{host.name}} 主机硬盘使用率超50%, 当前{{ (100 * host.hdd_used / host.hdd_total) | round }}% </pre>
{% endif %}
"""

但我通过 curl 方式区测试是正常的,能否告知我出了什么问题?

curl -X POST \
     -H 'Content-Type: application/json' \
     -d '{"chat_id": "88xxxx680", "text": "This is a test from curl", "disable_notification": true}' \
     https://api.telegram.org/bot2xxxx67783:AAF4eCz9XMm-TSnI0xxxxxxxx7WYOEAgxqw/sendMessage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions