case0sh / telegram-server-monitor

Telegram Bot for server monitoring.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Telegram Server Monitor

Monitoring service writen in Python3 to be hosted on your own server.

Installation

Talk to @BotFather on Telegram

  • Type /start to start a conversation with the bot father.
  • Type /newbot and follow the instructions to create our own bot.
  • Remember the access token - you will need it later.
  • You may configure your bot by setting a name or picture.

Configure your linux server

# Create a special user for the bot
sudo adduser telegram --gecos "" --disabled-password

# Install required packages with the package manager
sudo apt install python3-psutil python3-requests python3-netifaces

# OR install Python 3 and dependecies with pip
# use this only if you have problems with the commandline above...
#sudo apt install python3 python3-pip
#sudo python3 -m pip install requests psutil netifaces --upgrade

Download and install Telegram Server Monitor

# Change to the created user
su telegram
cd ~

git clone https://github.com/syxolk/telegram-server-monitor.git
cd telegram-server-monitor
cp config.template.py config.py

# Edit the config file with your favorite editor
vim config.py

Usage

Start the program with

python3 daemon.py

Open the crontab -e, add this code to the end of the file:

@reboot python3 /home/admin_bot/telegram-server-monitor/daemon.py

To keep your new telegram bot running when you logout you might want to checkout tmux, which is probably shipped with your favorite distribution.

Improve network-ports info

To get process details on the open ports please copy the file 50-netstat to /etc/sudoers.d/50-netstat

About

Telegram Bot for server monitoring.


Languages

Language:Python 100.0%