telegram bot hosted on lainlounge servers for remote system monitoring
Find a file
2024-12-27 21:34:32 +05:00
.authorized_users finished /reboot host and /restart host functions, added authorization for actions by telegram ID, added nginx to default services 2024-10-18 18:06:53 +05:00
.env horfix #4 (fucking insanity) 2024-10-05 01:38:52 +05:00
.gitignore add .gitignore 2024-10-05 00:35:18 +05:00
lainmonitor.py fixed authorization issue 2024-12-27 21:34:32 +05:00
LICENSE Initial commit 2024-10-04 18:55:32 +00:00
README.md Merge branch 'hax-readme_updoot' into dev 2024-10-25 18:00:55 +05:00
requirements.txt uploaded sou 2024-10-04 18:58:46 +00:00

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.

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!