forked from hornet/lainmonitor
86 lines
No EOL
2.2 KiB
Markdown
86 lines
No EOL
2.2 KiB
Markdown
# LainMonitor
|
||
|
||
LainMonitor is a Telegram bot designed to monitor your system, providing real-time updates on the system’s status, essential services, and disk usage. It can also verify connectivity to a specific Tailscale IP address.
|
||
### Key Features:
|
||
|
||
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
|
||
|
||
### Prerequisites:
|
||
|
||
Python 3
|
||
Telebot — Python library for interacting with the Telegram bot API.
|
||
|
||
### Installation Guide:
|
||
|
||
Clone the repository:
|
||
|
||
git clone https://git.lainlounge.xyz/hornet/lainmonitor.git
|
||
cd lainmonitor
|
||
|
||
Install dependencies:
|
||
|
||
pip3 install pyTelegramBotAPI
|
||
|
||
Configure your bot token: Open the lainmonitor.py file and replace the placeholder with your Telegram bot token:
|
||
|
||
TOKEN = 'YOUR_BOT_TOKEN'
|
||
|
||
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:
|
||
|
||
sudo nano /etc/systemd/system/lainmonitor.service
|
||
|
||
Add the following configuration:
|
||
|
||
[Unit]
|
||
Description=LainMonitor Telegram Bot
|
||
After=network.target
|
||
|
||
[Service]
|
||
ExecStart=/usr/bin/python3 /path/to/lainmonitor.py
|
||
Restart=on-failure
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
|
||
Enable and start the service:
|
||
|
||
sudo systemctl enable lainmonitor
|
||
sudo systemctl start lainmonitor
|
||
|
||
### Available Commands:
|
||
|
||
/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.
|
||
|
||
### Contributions:
|
||
|
||
Created by hornetmaidan.
|
||
With Contributions from h@x.
|
||
|
||
Any new features and suggestions are welcome! |