Skip to content

A telegram bot to track the status of an OpenVPN server

Notifications You must be signed in to change notification settings

totekuh/pyopenvpn-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenVPN Status Monitor

OpenVPN Status Monitor is a Python-based bot that monitors the status of an OpenVPN server and sends updates to a specified Telegram channel.

Features

  • Real-time monitoring of OpenVPN status log.
  • Notification of new connections and disconnections.
  • Whitelist access control for privileged bot commands.

Installation

Clone the repository.

git clone https://github.com/username/openvpn-status-monitor.git

Navigate to the project directory.

cd openvpn-status-monitor

Install the Python package.

pip install .

Docker Deployment

Build the Docker image.

docker build -t pyopenvpn-monitor .

Start the Docker container.

docker run --rm -it pyopenvpn-monitor -h

Configuration

Configuration of the OpenVPN Status Monitor is done via environment variables which can be placed in a .env file. An example .env file is provided in the repository. Please make sure to replace the placeholders with your actual values.

# .env example
TOKEN=your_telegram_token
OPENVPN_STATUS_LOG_FILE=/path/to/openvpn/status.log
WHITELIST=whitelisted_telegram_usernames_separated_by_comma

Please note that the OPENVPN_STATUS_LOG_FILE environment variable refers to the OpenVPN status log file inside the Docker container. Therefore, you have to ensure that the status log file of your OpenVPN server is properly mounted into the Docker container using Docker volumes.

The docker-compose file provided in the repository uses this environment variable to correctly mount your OpenVPN status log file.

Usage

  • /start command: Start monitoring the connection logs.
  • /stats command: Print current statistics from the OpenVPN server.
  • /help command: Show help message.

About

A telegram bot to track the status of an OpenVPN server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published