SkillAgentSearch skills...

VPSTrafficMonitor

This script monitors the remaining traffic of VMs on Vultr, DigitalOcean, and Linode. If the remaining traffic is zero, it shuts down the VM and sends a notification via Telegram.

Install / Use

/learn @iquping/VPSTrafficMonitor
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

VM Traffic Monitor

简体中文فارسی

This script monitors the remaining traffic of VMs on Vultr, DigitalOcean, and Linode. If the remaining traffic is zero, it shuts down the VM and sends a notification via Telegram.

Features

  • Monitors VM traffic on Vultr, DigitalOcean, and Linode.
  • Shuts down VM when traffic is depleted.
  • Sends notification via Telegram.

Setup

  1. Clone the repository
git clone https://github.com/yourusername/vm-traffic-monitor.git

cd vm-traffic-monitor
  1. Install dependencies
pip install requests pyyaml python-telegram-bot
  1. Configure the config.yaml

  2. Add execution permissions to the script

chmod +x check_traffic.py
  1. Set up a cron job to run the script periodically
crontab -e

Add the following line to run the script every hour:

0 * * * * /usr/bin/python3 /path/to/check_traffic.py >> /path/to/check_traffic.log 2>&1

Running as a Daemon(Optional)

To run the script as a daemon, you can use systemd on Linux:

  1. Create a systemd service file
sudo nano /etc/systemd/system/vm-traffic-monitor.service
  1. Add the following content to the service file
[Unit]
Description=VM Traffic Monitor
After=network.target

[Service]
ExecStart=/usr/bin/python3 /path/to/check_traffic.py
WorkingDirectory=/path/to
StandardOutput=file:/var/log/vm-traffic-monitor.log
StandardError=file:/var/log/vm-traffic-monitor.log
Restart=always

[Install]
WantedBy=multi-user.target

  1. Reload systemd and start the service
sudo systemctl daemon-reload
sudo systemctl start vm-traffic-monitor
sudo systemctl enable vm-traffic-monitor

Related Skills

View on GitHub
GitHub Stars33
CategoryDevelopment
Updated7mo ago
Forks4

Languages

Python

Security Score

67/100

Audited on Aug 13, 2025

No findings