Ad Widget

Collapse

Proxmox 8 LXC Container running Debian 12: Zabbix reports load average of host

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stalks
    Junior Member
    • Nov 2009
    • 15

    #1

    Proxmox 8 LXC Container running Debian 12: Zabbix reports load average of host

    Proxmox 8.0.4
    LXCFS on host using the "-l" argument so that container OS shows accurate load average
    Code:
    # ps aux|grep lxcfs
    root 17265 0.1 0.0 600832 1728 ? Ssl Oct08 42:31 /usr/bin/lxcfs /var/lib/lxcfs -l​
    Debian 12 LXC container
    In Container: /proc/loadavg is ~0.00 (idle)
    Zabbix Agent 2 6.4.7 reports loadavg >0, mimicking host

    Example, script to pull info from host and an LXC container
    Code:
    # echo; echo PVE HOST; ssh pve1 "uptime; cat /proc/loadavg"; docker exec -it zabbix-server zabbix_get -s 10.10.10.200 -k system.cpu.load; echo; echo LXC; ssh nm0 "uptime; cat /proc/loadavg"; docker exec -it zabbix-server zabbix_get -s 10.10.10.206 -k system.cpu.load
    
    PVE HOST
    23:15:27 up 20 days, 3:09, 2 users, load average: 6.33, 6.73, 5.80
    6.33 6.73 5.80 3/1106 2435565
    6.333984
    
    LXC
    22:15:27 up 25 min, 0 user, load average: 0.02, 0.01, 0.00
    0.02 0.01 0.00 0/41 1161721
    6.333984​
    So LXCFS is doing the right thing, and load average is reported correctly in the Linux container, but Zabbix is pulling loadavg from elsewhere and it reporting host.

    How can I get Zabbix to report load average correctly?
  • nils2
    Junior Member
    • Apr 2011
    • 26

    #2
    I can confirm the same on Proxmox VE 8.1 and a few newly upgraded LCX hosts running latest Debian 12/Bookworm. The load averages are that of the host, divided by the number of CPU cores of the LXC container. I'm using Zabbix 6.0.14 from the stock Debian repo in the CTs. I also tried with 5.0 and 6.4 to see if it makes a difference, but they all show the same wrong values. It used to be fine on Debian 10 and 11.

    Proxmox 8 uses LXC 5 and It seems that something changed (again) in how LXC presents load values on certain APIs.

    Comment

    • nils2
      Junior Member
      • Apr 2011
      • 26

      #3
      I delved a little more into the problem. It appears that the Zabbix agents use the getloadavg() stdlib call to get the 3 values of the system load. I've written a small POC to show that the values returned by the call are actually wrong. See the POC below.

      Code:
      $ cat loadavgtest.c
      #include <stdio.h>
      #include <stdlib.h>
      
      int main() {
          double loadavg[3];
      
          if (getloadavg(loadavg, 3) == -1) {
              perror("Error getting load average");
              return 1;
          }
      
          printf("%.2f %.2f %.2f\n", loadavg[0], loadavg[1], loadavg[2]);
      
          return 0;
      }
      $ gcc loadavgtest.c -o loadavgtest
      $ ./loadavgtest; cat /proc/loadavg
      0.88 0.76 0.81
      0.03 0.04 0.00 0/88 3348634
      Debian 10 and 11 used to be fine regarding the loadavg values. Debian 12 is wrong. I haven't tried other distros yet, but I'm inclined to think the issue lies with Debian in LXC and not Proxmox or Zabbix.

      Comment

      Working...