-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
204 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,71 @@ | ||
[中文](README_CN.md) | [English](README.md) | ||
|
||
# TeleMonitor | ||
|
||
TeleMonitor 是一个使用 Python 编写的系统监控工具,它可以监控 CPU、内存和磁盘的使用情况,并通过 Telegram 发送警告。 | ||
TeleMonitor is a system monitoring tool written in Python that can monitor CPU, memory, and disk usage and send alerts via Telegram. | ||
|
||
## 使用 | ||
## Usage | ||
|
||
首先,你需要创建一个 Telegram bot,然后获取 API token。你可以参考 [Telegram 官方文档](https://core.telegram.org/bots/features#botfather) 来创建一个 Telegram bot。 | ||
First, you need to create a Telegram bot and get the API token. You can refer to the [Telegram official documentation](https://core.telegram.org/bots/features#botfather) to create a Telegram bot. | ||
|
||
然后,你需要获取你希望接收警告的 Telegram chat ID。你可以使用 [@userinfobot](https://t.me/userinfobot) 来获取你的 chat ID。 | ||
Then, you need to get the Telegram chat ID where you want to receive alerts. You can use [@userinfobot](https://t.me/userinfobot) to get your chat ID. | ||
|
||
接下来 clone 这个项目: | ||
Next, clone this project: | ||
|
||
```bash | ||
git clone https://github.com/bboysoulcn/telemonitor.git | ||
``` | ||
|
||
你可以使用docker compose 来运行 Telemonitor: | ||
You can use docker compose to run TeleMonitor: | ||
|
||
```bash | ||
docker-compose up -d | ||
``` | ||
|
||
或者你可以使用 k8s 来运行 Telemonitor: | ||
Or you can use k8s to run TeleMonitor: | ||
|
||
```bash | ||
kubectl apply -f deployment.yaml | ||
``` | ||
|
||
下面是 Telemonitor 的环境变量: | ||
Here are the environment variables for 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`。 | ||
- `URL_LIST`: 需要监控的 URL 列表,用逗号分隔,默认值为空。 | ||
- `TG_API_TOKEN`: The API token of your Telegram bot. | ||
- `TG_CHAT_ID`: The Telegram chat ID where you want to receive alerts. | ||
- `TG_API_BASE_URL`: The base URL of the Telegram API, default is `https://api.telegram.org`. | ||
- `CPU_PERCENT`: The threshold for CPU usage. TeleMonitor will send an alert if the usage exceeds this value. Default is 80. | ||
- `MEMORY_PERCENT`: The threshold for memory usage. TeleMonitor will send an alert if the usage exceeds this value. Default is 80. | ||
- `DISK_PERCENT`: The threshold for disk usage. TeleMonitor will send an alert if the usage exceeds this value. Default is 80. | ||
- `MONITOR_INTERVAL`: The interval time (in seconds) for monitoring. Default is 60. | ||
- `DISK_PATH`: The path of the disk. Default is `/host`. | ||
- `URL_LIST`: The list of URLs to monitor, separated by commas. Default is empty. | ||
- `LANGUAGE`: The language. Default is `en`. Options are `en` and `cn`. | ||
|
||
下面是机器人的命令: | ||
Here are the commands for the bot: | ||
|
||
- /start - 获取帮助 | ||
- /help - 获取帮助 | ||
- /status - 获取系统状态 | ||
- /start - Get help | ||
- /help - Get help | ||
- /status - Get system status | ||
|
||
### 如果你不能访问Telegram API | ||
### If you cannot access the Telegram API | ||
|
||
你可以使用下面项目创建一个 api 代理,并且修改环境变量 TG_API_BASE_URL | ||
You can use the following project to create an API proxy and modify the environment variable `TG_API_BASE_URL`: | ||
|
||
[teleproxy](https://github.com/bboysoulcn/teleproxy) | ||
|
||
### 效果展示 | ||
### Demo | ||
|
||
![](./images/img1.webp) | ||
![](./images/img2.webp) | ||
|
||
## 贡献者 | ||
## Contributors | ||
|
||
- [SimonGino](https://github.com/SimonGino) | ||
|
||
## 广告位 | ||
## Telegram Channel | ||
|
||
我的tg频道 [https://t.me/bboyapp](https://t.me/bboyapp) | ||
My telegram channel: [https://t.me/bboysoulcn](https://t.me/bboysoulcn) | ||
|
||
## 许可证 | ||
## License | ||
|
||
这个项目使用 MIT 许可证,详情请见 [LICENSE](LICENSE) 文件。 | ||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
[中文](README_CN.md) | [English](README.md) | ||
|
||
# TeleMonitor | ||
|
||
TeleMonitor 是一个使用 Python 编写的系统监控工具,它可以监控 CPU、内存和磁盘的使用情况,并通过 Telegram 发送警告。 | ||
|
||
## 使用 | ||
|
||
首先,你需要创建一个 Telegram bot,然后获取 API token。你可以参考 [Telegram 官方文档](https://core.telegram.org/bots/features#botfather) 来创建一个 Telegram bot。 | ||
|
||
然后,你需要获取你希望接收警告的 Telegram chat ID。你可以使用 [@userinfobot](https://t.me/userinfobot) 来获取你的 chat ID。 | ||
|
||
接下来 clone 这个项目: | ||
|
||
```bash | ||
git clone https://github.com/bboysoulcn/telemonitor.git | ||
``` | ||
|
||
你可以使用docker compose 来运行 Telemonitor: | ||
|
||
```bash | ||
docker-compose up -d | ||
``` | ||
|
||
或者你可以使用 k8s 来运行 Telemonitor: | ||
|
||
```bash | ||
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`。 | ||
- `URL_LIST`: 需要监控的 URL 列表,用逗号分隔,默认值为空。 | ||
- `LANGUAGE`: 语言,默认值为 `en`。可选值为 `en` 和 `cn`。 | ||
|
||
下面是机器人的命令: | ||
|
||
- /start - 获取帮助 | ||
- /help - 获取帮助 | ||
- /status - 获取系统状态 | ||
|
||
### 如果你不能访问Telegram API | ||
|
||
你可以使用下面项目创建一个 api 代理,并且修改环境变量 TG_API_BASE_URL | ||
|
||
[teleproxy](https://github.com/bboysoulcn/teleproxy) | ||
|
||
### 效果展示 | ||
|
||
![](./images/img1.webp) | ||
![](./images/img2.webp) | ||
|
||
## 贡献者 | ||
|
||
- [SimonGino](https://github.com/SimonGino) | ||
|
||
## Telegram 频道 | ||
|
||
我的 Telegram 频道: [https://t.me/bboysoulcn](https://t.me/bboysoulcn) | ||
|
||
## 许可证 | ||
|
||
这个项目使用 MIT 许可证,详情请见 [LICENSE](LICENSE) 文件。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters