Skip to content

TeleMonitor 是一个使用 Python 编写的系统监控工具,它可以监控 CPU、内存和磁盘的使用情况,并通过 Telegram 发送警告。

License

Notifications You must be signed in to change notification settings

Colin-coder/telemonitor

 
 

Repository files navigation

TeleMonitor

TeleMonitor 是一个使用 Python 编写的系统监控工具,它可以监控 CPU、内存和磁盘的使用情况,并通过 Telegram 发送警告。

使用

首先,你需要创建一个 Telegram bot,然后获取 API token。你可以参考 Telegram 官方文档 来创建一个 Telegram bot。

然后,你需要获取你希望接收警告的 Telegram chat ID。你可以使用 @userinfobot 来获取你的 chat ID。

接下来 clone 这个项目:

git clone https://github.com/bboysoulcn/telemonitor.git

你可以使用docker compose 来运行 Telemonitor:

docker-compose up -d

或者你可以使用 k8s 来运行 Telemonitor:

kubectl apply -f deployment.yaml

下面是 Telemonitor 的环境变量:

  • TG_API_TOKEN: 你的 Telegram bot 的 API token。
  • TG_CHAT_ID: 你希望接收警告的 Telegram chat ID。
  • TG_API_BASE_URL: Telegram API 的基础 URL,默认值为 https://api.telegram.org.
  • CPU_PERCENT: CPU 使用率的阈值,超过这个阈值时,Telemonitor 会发送警告,默认值为 80。
  • MEMORY_PERCENT: 内存使用率的阈值,超过这个阈值时,Telemonitor 会发送警告,默认值为 80。
  • DISK_PERCENT: 磁盘使用率的阈值,超过这个阈值时,Telemonitor 会发送警告,默认值为 80。
  • MONITOR_INTERVAL: 监控的间隔时间(秒),默认值为 60。
  • DISK_PATH: 磁盘的路径,默认值为 /host

下面是机器人的命令:

  • /start - 获取帮助
  • /help - 获取帮助
  • /status - 获取系统状态

如果你不能访问Telegram API

你可以使用下面项目创建一个 api 代理,并且修改环境变量 TG_API_BASE_URL

teleproxy

效果展示

贡献者

许可证

这个项目使用 MIT 许可证,详情请见 LICENSE 文件。

About

TeleMonitor 是一个使用 Python 编写的系统监控工具,它可以监控 CPU、内存和磁盘的使用情况,并通过 Telegram 发送警告。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 95.9%
  • Dockerfile 4.1%