Open Ilmereth opened 1 month ago
TY to share this, I will fix it asap!
Thanks a lot. Looking forward to testing it. If you need Logs, or error messages let me know.
can I ask you your polling value?
My Polling Value is 600. I haven`t changed any values in /etc/lxc_autoscale/lxc_autoscale.yaml
One Correction to my first Post: Your script is not running in an LXC, but directly on the ProxMox Server.
when I run systemctl status lxcfs.service I get the following:
● lxcfs.service - FUSE filesystem for LXC Loaded: loaded (/lib/systemd/system/lxcfs.service; enabled; preset: enabled) Active: active (running) since Wed 2024-10-16 17:33:55 CEST; 43s ago Docs: man:lxcfs(1) Main PID: 7817 (lxcfs) Tasks: 4 (limit: 76768) Memory: 564.0K CPU: 3ms CGroup: /system.slice/lxcfs.service └─7817 /usr/bin/lxcfs /var/lib/lxcfs -l
Okt 16 17:33:55 blackbox lxcfs[7817]: - proc_meminfo Okt 16 17:33:55 blackbox lxcfs[7817]: - proc_stat Okt 16 17:33:55 blackbox lxcfs[7817]: - proc_swaps Okt 16 17:33:55 blackbox lxcfs[7817]: - proc_uptime Okt 16 17:33:55 blackbox lxcfs[7817]: - proc_slabinfo Okt 16 17:33:55 blackbox lxcfs[7817]: - shared_pidns Okt 16 17:33:55 blackbox lxcfs[7817]: - cpuview_daemon Okt 16 17:33:55 blackbox lxcfs[7817]: - loadavg_daemon Okt 16 17:33:55 blackbox lxcfs[7817]: - pidfds Okt 16 17:33:55 blackbox lxcfs[7817]: Ignoring invalid max threads value 4294967295 > max (100000).
I‘m Not sure if that is helping, or if it is an entirely different issue that ha nothing to do with your Software.
i will try this route to fix it..
def main_loop(poll_interval, energy_mode):
"""
The main loop for managing container resources.
Args:
poll_interval (int): The interval in seconds between each resource check.
energy_mode (bool): Whether to enable energy-saving mode during off-peak hours.
"""
while True:
# Example of where CPU or memory might be retrieved
containers = get_containers() # Assume this returns a list of container IDs
for ctid in containers:
try:
cpu_usage = get_cpu_usage(ctid) # Fetch CPU usage for the container
memory_usage = get_memory_usage(ctid) # Fetch memory usage for the container
# Ensure CPU and memory are valid numbers before proceeding
if cpu_usage.isdigit():
cpu_usage = int(cpu_usage)
else:
logging.error(f"Invalid CPU usage for container {ctid}: {cpu_usage}")
continue # Skip this container if the value is invalid
if memory_usage.isdigit():
memory_usage = int(memory_usage)
else:
logging.error(f"Invalid memory usage for container {ctid}: {memory_usage}")
continue # Skip this container if the value is invalid
# Perform scaling or other resource management actions based on CPU/memory usage
except ValueError as e:
logging.error(f"Error in processing container {ctid}: {e}")
continue # Skip to the next container in case of an error
# Wait for the poll interval before checking again
time.sleep(poll_interval)
gimme some time more to achieve it :) it seems that the value returned of cpu load or memory is not well managed and break the script
Thank you. Take all the time you need. I wish I could help you, but my knowledge of python is limited to installing the required Packages. Have a nice Weekend :)
After installing using the installer
curl -sSL https://raw.githubusercontent.com/fabriziosalmi/proxmox-lxc-autoscale/main/install.sh | bash then configuring it by using curl -sSL https://raw.githubusercontent.com/fabriziosalmi/proxmox-lxc-autoscale/main/lxc_autoscale/lxc_autoscale_autoconf.sh | bash
systemctl status lxc_autoscale.service
reports the following error:
● lxc_autoscale.service - LXC AutoScale Daemon Loaded: loaded (/etc/systemd/system/lxc_autoscale.service; enabled; preset: enabled) Active: active (running) since Sat 2024-10-12 18:32:02 CEST; 4min 52s ago Docs: https://github.com/fabriziosalmi/proxmox-lxc-autoscale Main PID: 15839 (python3) Tasks: 1 (limit: 76769) Memory: 42.2M CPU: 15.851s CGroup: /system.slice/lxc_autoscale.service └─15839 /usr/bin/python3 /usr/local/bin/lxc_autoscale/lxc_autoscale.py
Okt 12 18:32:04 blackbox python3[15839]: 2024-10-12 18:32:04 - CPU usage for container 101 using Load Average Method: 100.0% Okt 12 18:32:04 blackbox python3[15839]: 2024-10-12 18:32:04 - CPU usage for container 254 using Load Average Method: 100.0% Okt 12 18:32:04 blackbox python3[15839]: 2024-10-12 18:32:04 - CPU usage for container 249 using Load Average Method: 100.0% Okt 12 18:32:04 blackbox python3[15839]: 2024-10-12 18:32:04 - CPU usage for container 111 using Load Average Method: 100.0% Okt 12 18:32:04 blackbox python3[15839]: 2024-10-12 18:32:04 - CPU usage for container 108 using Load Average Method: 100.0% Okt 12 18:32:04 blackbox python3[15839]: 2024-10-12 18:32:04 - CPU usage for container 244 using Load Average Method: 70.0% Okt 12 18:32:04 blackbox python3[15839]: 2024-10-12 18:32:04 - CPU usage for container 100 using Load Average Method: 93.33% Okt 12 18:32:05 blackbox python3[15839]: 2024-10-12 18:32:05 - Starting resource allocation process... Okt 12 18:32:05 blackbox python3[15839]: 2024-10-12 18:32:05 - Ignoring LXC Containers: set() Okt 12 18:32:05 blackbox python3[15839]: 2024-10-12 18:32:05 - Error in main loop: invalid literal for int() with base 10: ''
To Reproduce Reboot Node systemctl status lxc_autoscale.service
Desktop (please complete the following information):