Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-26388

Docker by Agent 2 Template Provides Misleading Memory Usage

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 7.2.6
    • Templates (T)
    • None
    • Docker Hosted on Ubuntu 22 monitored by zabbix agent 2 using ootb template.

      Steps to reproduce:

      1. Assign the docker template to a linux docker host
      2. The "Memory Usage" container item includes inactive file memory which is not indicative of actual reserved memory usage. Confusing for users who see 8 GB in zabbix, but 2 GB in "docker stats".

      Result:

      The "Memory Usage" container stat is not useful for analyzing or monitoring container health or host impact. Has some use cases for reviewing "freed" memory of a container and debugging, but not dashboarding or alerts.

      Expected:

      Similar to the calculation done by the docker stats functions (https://github.com/docker/cli/blob/58d318b99030aebd1c946653165fbfd492b47b09/cli/command/container/stats_helpers.go#L227) total_inactive_file or inactive_file should be subtracted from memory.usage in order to report real reserved memory.

      In my case I did the following in the docker template:

      1. Change "Container {#NAME}: Get stats: Container {#NAME}: Memory usage" to "Container {#NAME}: Get stats: Container {#NAME}: Memory usage (raw)"
      2. Add a new stats-dependent item for "Container {#NAME}: Get stats: Container {#NAME}: Memory inactive file"
        1. Item Preprocessing:
          1. Replace "total_inactive_file" with "inactive_file" to be compatible with cgroup1 and cgroup2 stats.
          2. JSONPath "$.memory_stats.stats.inactive_file"
      3. Add a new calculated item "Container {#NAME}: Memory usage"
        Formula "last(//docker.container_stats.memory.usage"{#NAME}")-last(//docker.container_stats.memory.inactive_file"{#NAME}")"

      On Windows the user should just be using the PrivateWorkingSet attribute for usage (which is not applicable to unix hosts). So maybe the formula should use PrivateWorkingSet if it's not zero, otherwise the calculation mentioned above? Haven't tested docker-on-windows monitoring.

            zit Zabbix Integration Team
            jftkcs James
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: