Merge branch 'hax-readme_updoot' into dev

This commit is contained in:
hornet 2024-10-25 18:00:55 +05:00
commit 88b678da3b

106
README.md
View file

@ -1,53 +1,59 @@
# lainmonitor
lainmonitor is a Telegram bot designed to monitor your system by providing real-time information about the system's status, services, and disk usage. It can also check connectivity to a specific Tailscale IP address.
LainMonitor is a Telegram bot designed to monitor your system, providing real-time updates on the systems status, essential services, and disk usage. It can also verify connectivity to a specific Tailscale IP address.
### Key Features:
## Features
- Retrieve system hostname, uptime, and status of essential services such as:
- Zerotier
- Prosody
- PostgreSQL
- Tailscale
- Check disk usage
- Ping a Tailscale IP to verify connectivity
- Use via Telegram commands like `/status`, `/ping`, and `/help`
Retrieve system information:
Hostname
Uptime
Status of critical services:
Zerotier
Prosody
PostgreSQL
Tailscale
Check disk usage
Ping a Tailscale IP for connectivity verification
Accessible via Telegram commands such as /status, /ping, and /help
## Dependencies
- [Telebot](https://github.com/eternnoir/pyTelegramBotAPI) - A Python library for Telegram bot API.
### Prerequisites:
Python 3
Telebot — Python library for interacting with the Telegram bot API.
### Installation Guide:
Clone the repository:
## Installation
1. Clone this repository:
```bash
git clone https://git.lainlounge.xyz/hornet/lainmonitor.git
cd lainmonitor
```
2. Install the required Python library:
```bash
pip install pyTelegramBotAPI
```
3. Replace the placeholder in the .env file with your Telegram bot token
4. Add the .env file to .gitignore to prevent token overwriting
Install dependencies:
4. Set up permissions for the bot to check system services (run as a user with `sudo` access).
pip3 install pyTelegramBotAPI
## Usage
Configure your bot token: Open the lainmonitor.py file and replace the placeholder with your Telegram bot token:
### Running Directly
You can run the bot directly using Python:
TOKEN = 'YOUR_BOT_TOKEN'
```bash
python3 lainmonitor.py
```
Set up service access: Ensure the bot can check system services by running it with sudo or appropriate permissions.
### Usage:
#### Running the Bot Manually:
You can run LainMonitor directly from the command line:
python3 lainmonitor.py
#### Running as a Systemd Service:
To run the bot as a systemd service, follow these steps:
Create a service file:
### Running as a Service
To run LainMonitor as a service, follow these steps:
1. Create a systemd service file:
```bash
sudo nano /etc/systemd/system/lainmonitor.service
```
2. Add the following configuration:
```ini
Add the following configuration:
[Unit]
Description=LainMonitor Telegram Bot
After=network.target
@ -58,21 +64,23 @@ To run LainMonitor as a service, follow these steps:
[Install]
WantedBy=multi-user.target
```
3. Enable and start the service:
```bash
Enable and start the service:
sudo systemctl enable lainmonitor
sudo systemctl start lainmonitor
```
## Telegram Bot Commands
- `/start`: Initialize the bot and receive a welcome message.
- `/help`: Display available commands.
- `/status`: Get the system hostname, status, uptime, and the status of monitored services.
- `/ping`: Ping a Tailscale IP subnet and return the connectivity status for each peer.
- `/reboot`: (Work in progress) Placeholder for a reboot command.
### Available Commands:
## Author
Created by **hornet** and **hax**
/start — Initialize the bot and receive a welcome message.
/help — Display a list of available commands.
/status — Retrieve system hostname, uptime, and status of monitored services.
/ping — Ping a Tailscale IP and return connectivity status.
/reboot — (Work in progress) Placeholder for a system reboot command.
Feel free to contribute or suggest features!
### Contributions:
Created by hornetmaidan.
With Contributions from h@x.
Any new features and suggestions are welcome!