Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Automatically scale virtual machines resources on Proxmox hosts

License

NotificationsYou must be signed in to change notification settings

fabriziosalmi/proxmox-vm-autoscale

FOSSA Status

🌟 Overview

Proxmox VM Autoscale is a dynamic scaling service that automatically adjusts virtual machine (VM) resources (CPU cores and RAM) on your Proxmox Virtual Environment (VE) based on real-time metrics and user-defined thresholds. This solution helps ensure efficient resource usage, optimizing performance and resource availability dynamically.

The service supports multiple Proxmox hosts via SSH connections and can be easily installed and managed as asystemd service for seamless automation.

Important

To enable scaling of VM resources, make sure NUMA and hotplug features are enabled:

  • Enable NUMA: VM > Hardware > Processors > Enable NUMA ☑️
  • Enable CPU Hotplug: VM > Options > Hotplug > CPU ☑️
  • Enable Memory Hotplug: VM > Options > Hotplug > Memory ☑️

✨ Features

  • 🔄Auto-scaling of VM CPU and RAM based on real-time resource metrics.
  • 🛠️Configuration-driven setup using an easy-to-edit YAML file.
  • 🌐Multi-host support via SSH (compatible with both password and key-based authentication).
  • 📲Gotify Notifications for alerting you whenever scaling actions are performed.
  • ⚙️Systemd Integration for effortless setup, management, and monitoring as a Linux service.

📋 Prerequisites

  • 🖥️Proxmox VE must be installed on the target hosts.
  • 🐍Python 3.x should be installed on the Proxmox host(s).
  • 💻 Familiarity with Proxmoxqm commands and SSH is recommended.

🤝 Contributing

Contributions aremore than welcome! If you encounter a bug or have suggestions for improvement, pleaseopen an issue or submit a pull request.

Contributors

Code improvements by:Specimen67,brianread108

Want to scale LXC containers instead of VM on Proxmox hosts?

To autoscale LXC containers on Proxmox hosts, you may be interested inthis related project.

🚀 Quick Start

To installProxmox VM Autoscale, execute the followingcurl bash command. This command will automatically clone the repository, execute the installation script, and set up the service for you:

bash<(curl -s https://raw.githubusercontent.com/fabriziosalmi/proxmox-vm-autoscale/main/install.sh)

🎯This installation script will:

  • Clone the repository into/usr/local/bin/vm_autoscale.
  • Copy all necessary files to the installation directory.
  • Install the required Python dependencies.
  • Set up asystemd unit file to manage the autoscaling service.

Note

The service is enabled but not started automatically at the end of the installation. To start it manually, use the following command.

systemctl start vm_autoscale.service

Important

Make sure to review the officialProxmox documentation for the hotplug feature requirements to enable scaling virtual machines on the fly.

⚡ Usage

▶️ Start/Stop the Service

Tostart the autoscaling service:

systemctl start vm_autoscale.service

Tostop the service:

systemctl stop vm_autoscale.service

🔍 Check the Status

To view the service status:

systemctl status vm_autoscale.service

📜 Logs

Logs are saved to/var/log/vm_autoscale.log. You can monitor the logs in real-time using:

tail -f /var/log/vm_autoscale.log

Or by usingjournalctl:

journalctl -u vm_autoscale.service -f

⚙️ Configuration

The configuration file (config.yaml) is located at/usr/local/bin/vm_autoscale/config.yaml. This file contains settings for scaling thresholds, resource limits, Proxmox hosts, and VM information.

Example Configuration

scaling_thresholds:cpu:high:80low:20ram:high:85low:25scaling_limits:min_cores:1max_cores:8min_ram_mb:512max_ram_mb:16384check_interval:60# Check every 60 secondsproxmox_hosts:  -name:host1host:192.168.1.10ssh_user:rootssh_password:your_password_heressh_key:/path/to/ssh_keyvirtual_machines:  -vm_id:101proxmox_host:host1scaling_enabled:truecpu_scaling:trueram_scaling:truelogging:level:INFOlog_file:/var/log/vm_autoscale.loggotify:enabled:trueserver_url:https://gotify.example.comapp_token:your_gotify_app_token_herepriority:5

⚙️ Configuration Details

  • scaling_thresholds: Defines the CPU and RAM usage thresholds that trigger scaling actions (e.g., when CPU > 80%, scale up).
  • scaling_limits: Specifies theminimum andmaximum resources (CPU cores and RAM) each VM can have.
  • proxmox_hosts: Contains the details of Proxmox hosts, including SSH credentials.
  • virtual_machines: Lists the VMs to be managed by the autoscaling script, allowing per-VM scaling customization.
  • logging: Specifies the logging level and log file path for activity tracking and debugging.
  • gotify: ConfiguresGotify notifications to send alerts when scaling actions are performed.

📲 Gotify Notifications

Gotify is used to send real-time notifications regarding scaling actions. Configure Gotify in theconfig.yaml file:

  • enabled: Set totrue to enable notifications.
  • server_url: URL of the Gotify server.
  • app_token: Authentication token for accessing Gotify.
  • priority: Notification priority level (1-10).

👨‍💻 Development

🔧 Requirements

  • Python 3.x
  • Required Python Packages:paramiko,requests,PyYAML

🐛 Running Manually

To run the script manually for debugging or testing:

python3 /usr/local/bin/vm_autoscale/autoscale.py

Others projects

If You like my projects, you may also like these ones:

  • caddy-waf Caddy WAF (Regex Rules, IP and DNS filtering, Rate Limiting, GeoIP, Tor, Anomaly Detection)
  • patterns Automated OWASP CRS and Bad Bot Detection for Nginx, Apache, Traefik and HaProxy
  • blacklists Hourly updated domains blacklist 🚫
  • UglyFeed Retrieve, aggregate, filter, evaluate, rewrite and serve RSS feeds using Large Language Models for fun, research and learning purposes
  • proxmox-lxc-autoscale Automatically scale LXC containers resources on Proxmox hosts
  • DevGPT Code togheter, right now! GPT powered code assistant to build project in minutes
  • websites-monitor Websites monitoring via GitHub Actions (expiration, security, performances, privacy, SEO)
  • caddy-mib Track and ban client IPs generating repetitive errors on Caddy
  • zonecontrol Cloudflare Zones Settings Automation using GitHub Actions
  • lws linux (containers) web services
  • cf-box cf-box is a set of Python tools to play with API and multiple Cloudflare accounts.
  • limits Automated rate limits implementation for web servers
  • dnscontrol-actions Automate DNS updates and rollbacks across multiple providers using DNSControl and GitHub Actions
  • proxmox-lxc-autoscale-ml Automatically scale the LXC containers resources on Proxmox hosts with AI
  • csv-anonymizer CSV fuzzer/anonymizer
  • iamnotacoder AI code generation and improvement

⚠️ Disclaimer

Caution

The author assumes no responsibility for any damage or issues that may arise from using this tool.

📜 License

This project is licensed under theMIT License. See the LICENSE file for complete details.

FOSSA Status

About

Automatically scale virtual machines resources on Proxmox hosts

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Contributors7


[8]ページ先頭

©2009-2025 Movatter.jp