Giter VIP home page Giter VIP logo

serverstatus-rust's People

Contributors

asukaminato0721 avatar dependabot[bot] avatar evilgaoshu avatar fiercex avatar harvies avatar hinatakato avatar i207m avatar kissyouhunter avatar mjjrock avatar mobeicanyue avatar mslxi avatar n0thing2speak avatar renovate-bot avatar renovate[bot] avatar snowie2000 avatar xkrfer avatar zdz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverstatus-rust's Issues

动态注册无法触发TG上下线告警吗

[tgbot]
# 开关 true 打开
enabled = true
bot_token = "5688616854:AAHd-dbjLc3Ff3F4ErSYk92SdMqwFPh0ob8"
chat_id = "1342176258"
# host 可用字段参见 payload.rs 文件 HostStat 结构, {{host.xxx}} 为占位变量
# 例如 host.name 可替换为 host.alias,大家根据自己的喜好来编写通知消息
# {{ip_info.query}} 主机 ip,  {{sys_info.host_name}} 主机 hostname
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 %}
"""

Dec 21 17:33:58 GreenCloud.1665472394 systemd[1]: Started ServerStatus-Rust Server.
Dec 21 17:33:58 GreenCloud.1665472394 stat_server[1442]: ✨ stat_server v1.6.1 (, 2022-12-21 09:32:12 UTC, rustc 1.66.0)
Dec 21 17:33:58 GreenCloud.1665472394 stat_server[1442]: ✨ run in normal mode, load conf from local file `/usr/local/ServerSt>
Dec 21 17:33:58 GreenCloud.1665472394 stat_server[1442]: ✨ admin_user: admin
Dec 21 17:33:58 GreenCloud.1665472394 stat_server[1442]: ✨ admin_pass: xxxxxx
Dec 21 17:33:58 GreenCloud.1665472394 stat_server[1442]: 🚀 listening on http://127.0.0.1:8080
Dec 21 17:33:58 GreenCloud.1665472394 stat_server[1442]: 🚀 listening on grpc://0.0.0.0:9394

我用 #60 里面的测试代码会有一条❗️ServerStatus test msg信息 但是服务器上下线没有

log无限占用存储空间

主控是docker版的最新的,就这几天装的。log文件只存储不清理,几天时间就占了80+g

关于自定义标签 labels中ndd的tg自定义通知设置请教(非Bug)

大佬,现在的版本能够设定自定义标签 labels ,其中 ndd “年月日”可以设定为小鸡的到期时间。
有没有办法通过tg自定义通知设置,来实现在小鸡到期前x天TG提醒,以便于提醒续费?
1、如果可以的话,这个自定义设置应该怎么写?
2、如果现在还不行的话,后期是否有过考虑增加这个功能?

Alpine Linux 的 TCP 连接数溢出

版本:最新 v1.5.7(之前版本也有此问题)

Alpine Linux 上的 Rust 客户端回报的 TCP/UDP 连线数为4294967295,怀疑是uint溢出导致的。
这一现象其实在 #18 (comment) 中也有显示:\"tcp\":4294967295,

截图:

image

手机端显示请求

谢谢作者的app,已经布置好了,确实很不错👍

但是有个问题就是手机端显示,请问如何设置才能像桌面那样显示完整?(主要问题想看ping)状态。
我手机端如chrome选了显示桌面版本但是还是没有变化。

谢谢🙏

探针最后一栏【联通 | 电信 | 移动】显示不全

大佬,脚本部署,1.57版本,尝试了3款浏览器:360,Chrome,Firefox,在最后一栏的【联通 | 电信 | 移动】显示不全。

请教下,应该怎么解决?

恐表述不清,直接上图说明(标记红框处就是显示有缺的)

Chrome【100%显示比例,最后一列标题还出现了换行,对应数据显示不全】:
image

Firefox【100%显示比例,最后一列标题单行正常,对应数据显示不全】:
image

360【100%显示比例,最后一列标题单行正常,对应数据显示不全】:
image

ipv6 only小鸡安装的问题

纯ipv6小鸡,是否能够安装?从实际操作来看,不知道该如何配置才能实现纯ipv6小鸡安装探针,请大佬指点,非常感谢!

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update rust crate anyhow to v1.0.86
  • fix(deps): update rust crate clap to v4.5.14
  • fix(deps): update rust crate log to v0.4.22
  • fix(deps): update rust crate mime_guess to v2.0.5
  • fix(deps): update rust crate regex to v1.10.6
  • fix(deps): update rust crate rustls to v0.23.12
  • fix(deps): update rust crate rustls-pemfile to v2.1.3
  • fix(deps): update rust crate serde_json to v1.0.122
  • fix(deps): update rust crate toml to v0.8.19
  • fix(deps): update rust crate url to v2.5.2
  • fix(deps): update rust crate webpki-roots to v0.26.3
  • fix(deps): update rust crate bytes to v1.7.1
  • fix(deps): update rust crate hyper to v1.4.1
  • fix(deps): update rust crate lazy_static to v1.5.0
  • fix(deps): update rust crate prost to 0.13
  • fix(deps): update rust crate rhai to v1.19.0
  • fix(deps): update rust crate rust-embed to v8.5.0
  • fix(deps): update rust crate sysinfo to 0.31.0
  • fix(deps): update rust crate tokio to v1.39.2
  • fix(deps): update rust crate uuid to v1.10.0
  • fix(deps): update tonic monorepo to 0.12 (tonic, tonic-build)
  • chore(deps): update dependency zui to v3
  • chore(deps): update docker/build-push-action action to v6
  • chore(deps): update rust crate protobuf-src to v2
  • fix(deps): update rust crate minijinja to v2
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

cargo
client/Cargo.toml
  • anyhow 1
  • bytes 1
  • chrono 0.4
  • clap 4.5
  • fastrand 2.0.1
  • hyper 1.2
  • lazy_static 1.4
  • log 0.4
  • md5 0.7.0
  • once_cell 1
  • pretty_env_logger 0.5
  • prettytable-rs ^0.10
  • prost 0.12
  • regex 1.10
  • reqwest 0.11
  • rustls 0.23.5
  • rustls-pemfile 2
  • serde 1.0
  • serde_json 1.0
  • sysinfo 0.30.7
  • tokio 1
  • tokio-rustls 0.26
  • tonic 0.11
  • tower 0.4
  • webpki-roots 0.26
  • url 2.5.0
  • chrono 0.4
common/Cargo.toml
  • bytes 1
  • prost 0.12
  • serde 1.0
  • tonic 0.11
  • chrono 0.4
  • tonic-build 0.11
  • chrono 0.4
  • protobuf-src 1
  • tonic-build 0.11
server/Cargo.toml
  • anyhow 1
  • axum 0.7.4
  • axum-extra 0.9.2
  • bytes 1
  • chrono 0.4
  • clap 4.5
  • futures-util 0.3
  • hyper 1.2
  • jsonwebtoken 9.2
  • lazy_static 1.4
  • lettre 0.11
  • log 0.4
  • md5 0.7.0
  • minijinja 1.0
  • mime_guess 2
  • once_cell 1
  • pki-types 1
  • pretty_env_logger 0.5
  • prettytable-rs ^0.10
  • prost 0.12
  • reqwest 0.11
  • rhai 1.17
  • rust-embed 8.3
  • rustls-pemfile 2
  • serde 1.0
  • serde_json 1.0
  • tokio 1
  • tokio-rustls 0.26
  • toml 0.8
  • tonic 0.11
  • tower-http 0.5
  • url 2.5.0
  • uuid 1.7
  • chrono 0.4
docker-compose
docker-compose.yml
dockerfile
Dockerfile
  • rust 1.76-alpine3.19
Dockerfile.cloud
droneci
.drone.yml
github-actions
.github/workflows/docker.yml
  • actions/checkout v4
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • docker/login-action v3
  • docker/build-push-action v5
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-python v4
  • PyO3/maturin-action v1
  • PyO3/maturin-action v1
  • actions/upload-artifact v3
  • svenstaro/upx-action v2
  • actions/upload-artifact v4
  • TheDoctor0/zip-release 0.7.6
  • TheDoctor0/zip-release 0.7.6
  • softprops/action-gh-release v2
  • actions/checkout v4
  • PyO3/maturin-action v1
  • PyO3/maturin-action v1
  • actions/upload-artifact v3
  • actions/upload-artifact v3
  • actions/upload-artifact v3
  • svenstaro/upx-action v2
  • actions/upload-artifact v4
  • TheDoctor0/zip-release 0.7.6
  • TheDoctor0/zip-release 0.7.6
  • softprops/action-gh-release v2
  • actions/checkout v4
  • actions-rs/toolchain v1
  • arduino/setup-protoc v1
  • actions-rs/cargo v1
  • actions-rs/cargo v1
  • svenstaro/upx-action v2
  • actions/upload-artifact v4
  • TheDoctor0/zip-release 0.7.6
  • TheDoctor0/zip-release 0.7.6
  • TheDoctor0/zip-release 0.7.6
  • TheDoctor0/zip-release 0.7.6
  • softprops/action-gh-release v2
  • actions/download-artifact v3
  • actions/setup-python v4
.github/workflows/rust.yml
  • actions/checkout v4
  • actions-rs/toolchain v1
  • Swatinem/rust-cache v2
html
web/jinja/detail_ht.jinja.html
  • zui 1.10.0
  • zui 1.10.0
  • zui 1.10.0
web/jinja/map.jinja.html
  • leaflet 1.9.4
  • leaflet 1.9.4
pep621
client/pyproject.toml
  • maturin >=1.0,<2.0
server/pyproject.toml
  • maturin >=1.0,<2.0

  • Check this box to trigger a request for Renovate to run again on this repository

新前端的“协议”二字换行

image

如图红圈,在4K显示屏和iPad Pro 11寸上都复现了这个问题。

另:想问一下/detail/map的入口在新首页上没有看到,以后还有计划加入吗?

国内机无法检测IPV4

服务端只显示IPV6 机器是双栈的 IPV4正常可用
Dec 16 15:38:53 coal-w768p1ep stat_client[2568814]: enable feature native
Dec 16 15:38:56 coal-w768p1ep stat_client[2568814]: get_network (ipv4, ipv6) => (false, false)
Dec 16 15:38:56 coal-w768p1ep stat_client[2568814]: ERROR stat_client > refresh_ip_info error => error sending request for url (http://ip-api.com/json?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,district,zip,lat,lon,t>
Dec 16 15:38:56 coal-w768p1ep stat_client[2568814]: Caused by:
Dec 16 15:38:56 coal-w768p1ep stat_client[2568814]: 0: connection error: Connection reset by peer (os error 104)
Dec 16 15:38:56 coal-w768p1ep stat_client[2568814]: 1: Connection reset by peer (os error 104)
Dec 16 15:38:59 coal-w768p1ep stat_client[2568814]: ERROR stat_client > refresh_ip_info error => error sending request for url (http://ip-api.com/json?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,district,zip,lat,lon,t>
Dec 16 15:38:59 coal-w768p1ep stat_client[2568814]: Caused by:
Dec 16 15:38:59 coal-w768p1ep stat_client[2568814]: 0: connection error: Connection reset by peer (os error 104)
Dec 16 15:38:59 coal-w768p1ep stat_client[2568814]: 1: Connection reset by peer (os error 104)

不显示延迟

如图 不知道是我哪里配置出了问题,但都是照做的
image

alias不能显示

大佬您好,经过学习,已经安装了面板,有个小疑问,我用的是docker版本,面板界面“节点名”显示的是“name”,而登录面板后台,节点名显示的是“alias”展示名,是否可以调整一下?

vnstat 配置 MonthRotate 为非 1 的天数后,当前月份流量特定时间内会错误显示为 0.00G | 0.00G

有一些机器上的流量不是按自然月刷新的,比如在15日刷新并且将 vnstatMonthRotate 也配置为15,那么在15日之前 vnstat --json m 返回的数据会存在不包含当前自然月流量信息的情况,导致 ServerStatus-Rust 显示的月流量为 0.00G | 0.00G.

vnstat json 输出样例 (省略中间部分月份)

{
    "vnstatversion": "2.6",
    "jsonversion": "2",
    "interfaces": [
        {
            "name": "eth0",
            "alias": "",
            "created": {
                "date": {
                    "year": 2022,
                    "month": 3,
                    "day": 1
                }
            },
            "updated": {
                "date": {
                    "year": 2022,
                    "month": 11,
                    "day": 6
                },
                "time": {
                    "hour": 6,
                    "minute": 25
                }
            },
            "traffic": {
                "total": {
                    "rx": 34838225310,
                    "tx": 537051064160
                },
                "month": [
                    {
                        "id": 1,
                        "date": {
                            "year": 2022,
                            "month": 3
                        },
                        "rx": 120663351707,
                        "tx": 107577662878
                    },
                    {
                        "id": 7,
                        "date": {
                            "year": 2022,
                            "month": 9
                        },
                        "rx": 37335903948,
                        "tx": 23122453659
                    },
                    {
                        "id": 8,
                        "date": {
                            "year": 2022,
                            "month": 10
                        },
                        "rx": 21771011198,
                        "tx": 9919763673
                    }
                ]
            }
        }
    ]
}

stat_server 版本:

❯ /usr/local/ServerStatus/server/stat_server --version
stat_server v1.5.6 GIT:51f17c7, BUILD:2022-11-02 16:17:06 UTC

stat_client 版本:

❯ /usr/local/ServerStatus/client/stat_client --version
stat_client v1.5.6 GIT:51f17c7, BUILD:2022-11-02 16:17:07 UTC

主机信息警告能否添加显示ip功能

主机信息警告能否添加显示ip功能?比如能否显示ip(168.****.87)。

online_tpl =  "{{config.title}} \n[主机故障] {{host.alias}} ( {{host.ip}} : 主机恢复上线啦"
offline_tpl = "{{config.title}} \n[主机故障] {{host.alias}} ( {{host.ip}} ): 主机已经掉线啦"

最终TG上显示则为:

 [主机故障] 墨尔本(134.****.35) : 主机已经掉线啦
 [主机故障] 墨尔本(168.****.87) : 主机已经掉线啦

ip 可以不显示整个ip,仅仅显示首和尾,这样比较好区分。特别是在该区有相同的VPS时会比较好方便管理和区分。

monthstart = 1, disabled = false这两个参数做什么用的

我翻阅了参考的链接和直接搜索了这两个参数,没有找到相关的说明

并且我使用 railway 部署遇到了favicon.ico无法部署到 railway 的问题,就是直接访问 网站地址/favicon.ico 时候出现了404,我在index.html里面从新指向到了 img/favicon.ico 后,图标才从新加载出来

保留显示离线客户端的最后数据

目前在客户端掉线后,该主机对应的条目将会隐藏掉所有信息,但有时候机器掉线前的状态对排错很有帮助。是否可以增加一个选项,客户端掉线时仅改变显示方式(比如改变对应行的配色,增加⚠️标志等),在服务器运行期间维持显示之前收到的数据,客户端重新上线后恢复?

stat_client.py 返回的丢包率数据有问题,对小数点后的数字没有格式化

已有的issues都看了,没看到类似的问题,如有重复,麻烦作者删除此issues

我的配置

❯ vnstat -v
vnStat 2.6 by Teemu Toivola <tst at iki dot fi>

文件 client/src/stat_client.py

if packet_queue.qsize() > 30:
    G_LOST_RATE[mark] = float(packet_lost) / packet_queue.qsize()

返回的数据没有去掉小数点后的数字

现象

bug

bug1

我改了一下代码

if packet_queue.qsize() > 30:
    packet_lost_rate = float(packet_lost) / packet_queue.qsize()
    G_LOST_RATE[mark] = round(packet_lost_rate,2)

脚本部署安装问题

再次提问希望老大不要生气,虽然您的文档写的很清楚,但是对于小白我来说,还是有的不理解。希望你能耐心解答下

1.#服务端安装:
wget --no-check-certificate -qO status.sh 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/status.sh'
bash status.sh -i -s【服务器IP为X.X.X.X】
2#安装 客户端
wget --no-check-certificate -qO status.sh 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/status.sh'
bash status.sh -i -c
[注意] 请输入服务端的信息, 格式为 "protocol://username:password@master:port"
protocol://h1:[email protected]:8080

不知道这样的输入是否正确。

这里的username对应以下的name ,password 对应以下的password master对应服务段IP port要么是 9394 或者8080
grpc_addr = "0.0.0.0:9394"
http_addr = "0.0.0.0:8080"

hosts = [
{name = "h1", password = "p1", alias = "n1", location = "🏠", type = "kvm", labels = "os=arch;ndd=2022/11/25;spec=2C/4G/60G;"},
{name = "h2", password = "p2", alias = "n2", location = "🏢", type = "kvm", disabled = false},
{name = "h3", password = "p3", alias = "n3", location = "🏡", type = "kvm", monthstart = 1},
{name = "h4", password = "p4", alias = "n4", location = "cn", type = "kvm", notify = true, labels = "ndd=2022/11/25;spec=2C/4G/60G;"},

最小化配置

{name = "mac", password = "pp", alias = "macos"},
{name = "pi", password = "pp", alias = "pi", labels = "os=pi"},
{name = "win", password = "pp", alias = "windows"},
{name = "android", password = "pp", alias = "android", labels = "os=android"},
]

这里的

eg:【这里eg什么意思啊】

bash status.sh -i -c grpc://h1:[email protected]:9394
bash status.sh -i -c http://h1:[email protected]:8080

127.0.0.1这个是服务端和客户端在同一台服务器上安装的方式吗

如果服务器和客户端不是同一个机器这里的127.0.0.1是不是需要改成服务端的IP地址

请问若无法访问 Github,CN=true bash status.sh args

您好,确实在很多场景都被卡住了无法继续安装测试,但注意到您这句备注“若无法访问 Github:
CN=true bash status.sh args”,但不知是何种解决方式,是脚本直接可以解决吗?请指教
,感谢帮助!

1.7.1-1.7.0兼容问题

1.7.0的server直接用快速脚本似乎下载了1.7.1的client导致上报数据解析错误.
建议1.7.0和1.7.1之间互相兼容一下.

教程能否加上宝塔部署方法

我看好 Rust 版 ServerStatus,但是服务器有宝塔,通过宝塔部署没教程,完全按教程部署又怕和宝塔的nginx冲突!
求教程,方便菜鸡!

可以增加一个推送间隔的参数吗

我通过网页F12查看到信息是在不停的推送的,希望可以增加一个时间参数,用来设置间隔多少秒推送一次服务器信息,这个我自己判断是在服务端进行的?不是很确定,希望能增加这样一个功能

提交 issue 必读(除非你并不需要解决问题)

提交 issue 前请先做以下检查

  1. 大家时间都很宝贵,为节省彼此时间,建议先阅读 提问的艺术
  2. 详细阅读文档(就这么一点文档)和对应版本的 Release 说明,是否还是不能解决问题
  3. 搜索已有的 Issues | Discussions,是否出现过
  4. nginx, tg, wx, email 配置类问题可以先尝试 google 解决
  5. serverclient 的版本是否适配,启用 vnstat 版本是否 vnstat >= 2.6
  6. server 起不来一般是配置文件版本不兼容,先使用最新版本 config.toml 修改看看,并删除 stats.json 文件
  7. 尝试最新版本是否已经修复了你的问题
  8. Bugissue 请带上错误日志和版本号(用 -V 参数可以查询到)
  9. 不确定的问题可以先走讨论区 Discussions, 并尽可能带上你的问题日志
  10. 代码,配置做好排版、格式化、格式化、格式化

服务端与客户端支持HTTPS传输

首先,感谢作者的辛苦付出,这是大伙有目共睹的。目前该探针支持grcp和http与部署在多台的客户端机器进行通信,我想能否添加支持https传输的形式?

stat_client运行报错。连接运行正常

Feb 24 01:06:13 winter stat_client[873]: ERROR stat_client > report error => reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, 用户名: "", 密码:无,主机:一些(域(“ss.******.xyz”)),端口:无,路径:“/report”,查询:无,片段:无},来源:hyper::Error( Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })) }甲骨文云arm,本机安装
服务端和客户端。正常连接,数据正常。查看客户端状态systemctl status stat_client,显示上面的错误,有6条。不知道是怎么回事?谢谢

关于卸载

请问有卸载吗?一键安装怎么卸载,谢谢!

stat_client 在 Alpine 上运行报错

尝试在Alpine Linux下运行报错如下:

./stat_client -a "https://host/report" -u user -p pass
[client/src/main.rs:297] &args = Args {
    addr: "https://host/report",
    user: "user",
    pass: "pass",
    vnstat: false,
    disable_tupd: false,
    disable_ping: false,
    ct_addr: "ct.tz.cloudcpp.com:80",
    cm_addr: "cm.tz.cloudcpp.com:80",
    cu_addr: "cu.tz.cloudcpp.com:80",
}
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 2', client/src/status.rs:187:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted

client版本为 1.3.5
相同配置在debian11中正常运行

服务管理脚本部署问题咨询

使用# 下载脚本
wget --no-check-certificate -qO status.sh 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/status.sh'

安装 服务端

bash status.sh -i -s 【已经安装IP:168.138.X.X】

安装 客户端

bash status.sh -i -c

[注意] 请输入服务端的信息, 格式为 "protocol://username:password@master:port"

protocol://username:[email protected]:8080

请问这里的username:password都对应服务器的什么参数啊

哪里可以设置呢

关于无法触发tg警告

我的配置文件上,配置了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

自定义 ping 地址

自定义 ping 地址可以任意设置地址吗?可以设置为自己的ip,用域名设置吗?我尝试了一下,设置为当地域名能正确获取,如sc.189.cn:80。但设置为自己的域名就不能正确获取!谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.