lainmonitor/README.md

89 lines
No EOL
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# lainmonitor
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.
Current version: v1.2
### 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.
/restart hostname- Restart a specific service on a specified machine.
/reboot hostname — Placeholder for a system reboot command.
### Contributions:
Created by hornetmaidan.
With Contributions from h@x.
Any new features and suggestions are welcome!