Compare commits

..

No commits in common. "main" and "dev" have entirely different histories.
main ... dev

2 changed files with 7 additions and 20 deletions

View file

@ -1,8 +1,6 @@
# lainmonitor # 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. 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: ### Key Features:
Retrieve system information: Retrieve system information:
@ -13,12 +11,9 @@ Current version: v1.2
Prosody Prosody
PostgreSQL PostgreSQL
Tailscale Tailscale
nginx
Check disk usage Check disk usage
Ping a Tailscale IP for connectivity verification Ping a Tailscale IP for connectivity verification
Restart critical services Accessible via Telegram commands such as /status, /ping, and /help
Reboot the host
Accessible via Telegram commands
### Prerequisites: ### Prerequisites:
@ -32,20 +27,13 @@ Clone the repository:
git clone https://git.lainlounge.xyz/hornet/lainmonitor.git git clone https://git.lainlounge.xyz/hornet/lainmonitor.git
cd lainmonitor cd lainmonitor
RECOMMENDED: Create a virtual environment for python with:
```
python3 -m venv venv
source venv/bin/activate
```
Install dependencies: Install dependencies:
``` pip3 install pyTelegramBotAPI
pip3 install -r requirements.txt
```
Configure your bot token: Open the .env file and replace the placeholder with your Telegram bot token. Configure your bot token: Open the lainmonitor.py file and replace the placeholder with your Telegram bot token:
Configure authorized users: Open the .authorized_users file and replace the placeholders with Telegram user ID(s). TOKEN = 'YOUR_BOT_TOKEN'
Set up service access: Ensure the bot can check system services by running it with sudo or appropriate permissions. Set up service access: Ensure the bot can check system services by running it with sudo or appropriate permissions.
@ -88,8 +76,7 @@ Enable and start the service:
/help — Display a list of available commands. /help — Display a list of available commands.
/status — Retrieve system hostname, uptime, and status of monitored services. /status — Retrieve system hostname, uptime, and status of monitored services.
/ping — Ping a Tailscale IP and return connectivity status. /ping — Ping a Tailscale IP and return connectivity status.
/restart hostname- Restart a specific service on a specified machine. /reboot — (Work in progress) Placeholder for a system reboot command.
/reboot hostname — Placeholder for a system reboot command.
### Contributions: ### Contributions:

View file

@ -4,7 +4,7 @@
# usage: python3 lainmonitor.py | or run it as a service # usage: python3 lainmonitor.py | or run it as a service
# author: hornetmaidan # author: hornetmaidan
# contributors: h@x # contributors: h@x
# version: 1.2 # version: 1.1.6
import os import os
import subprocess import subprocess
import threading import threading
@ -161,7 +161,7 @@ def handle(message):
bot.reply_to(message, 'You are not authorized for this action') bot.reply_to(message, 'You are not authorized for this action')
else: else:
if message.text == '/start': if message.text == '/start':
bot.reply_to(message, 'lainmonitor v1.2 --- standing by...') bot.reply_to(message, 'lainmonitor v1.0 --- standing by...')
elif message.text == '/help': elif message.text == '/help':
bot.reply_to(message, 'commands: /start, /help, /status, /restart, /reboot, /ping') bot.reply_to(message, 'commands: /start, /help, /status, /restart, /reboot, /ping')
bot.reply_to(message, 'commands: /start, /help, /status, /restart, /reboot, /ping') bot.reply_to(message, 'commands: /start, /help, /status, /restart, /reboot, /ping')