Ad Widget

Collapse

Docker: Memory total missing data

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • s3ct0r
    Junior Member
    • Feb 2024
    • 6

    #1

    Docker: Memory total missing data

    Hello,
    i have zabbix server 6.4.10, and the agent on the remote server also is the latest,
    what i noticed is that the if i go to Latest data on my host and select the specific containers the graphs about Total Memory Usage are populated correctly,
    but the graph "Docker: Memory total" which should contain the total usage of the memory of all the containers all together, isn't populated at all.
    Is there any action i should do or this is a bug of the template (Docker by Zabbix agent 2​)?
    Thank you for the support.
  • Answer selected by s3ct0r at 07-02-2024, 20:17.
    s3ct0r
    Junior Member
    • Feb 2024
    • 6

    Done with a custom script.
    Click image for larger version

Name:	image.png
Views:	279
Size:	74.3 KB
ID:	478625
    following the Script:
    Code:
    docker stats --no-stream --format 'table {{.MemUsage}}' | sed -n '1!p' | cut -d '/' -f1 | sed 's/GiB/ * 1024 MiB/;s/MiB/ * 1024 KiB/;s/KiB/ * 1024/; s/$/ +\\/; $a0' | bc | numfmt --to=iec-i --suffix=B

    Comment

    • Shaman0S
      Junior Member
      • Sep 2022
      • 11

      #2
      Item "Docker: Memory total" (docker.mem.total) is a dependent item from "Docker: Get info" (docker.info).

      Try to test docker.info on a host. It should provide you some json output. Check whether output contains "MemTotal" field.

      I have 6.4.10 installed but haven't updated template yet. Don't have this problem

      Comment

      • s3ct0r
        Junior Member
        • Feb 2024
        • 6

        #3
        Hello Shaman0S,
        if i test manually i get an error,
        Click image for larger version

Name:	image.png
Views:	290
Size:	20.4 KB
ID:	478566
        and on the server
        user@server-01:~$ docker info | grep -i mem
        Total Memory: 15.61GiB
        But this memory is the total memory of the server, not the total memory used by docker.
        Any ideas?

        Comment

        • Shaman0S
          Junior Member
          • Sep 2022
          • 11

          #4
          Hi,

          You need to test parent docker.info item (see screenshot below)

          ​​

          Check if MemTotal is inside json output

          Click image for larger version

Name:	image.png
Views:	275
Size:	760.3 KB
ID:	478579

          Comment

          • s3ct0r
            Junior Member
            • Feb 2024
            • 6

            #5
            Hi Shaman0S​,
            i dont see the first foto,
            can please upload again?
            P.S yes the
            "MemTotal":16756031488
            is there, but this isn't the total usage of the docker, this is the total memory of the server.
            Any ideas?
            Last edited by s3ct0r; 07-02-2024, 13:12.

            Comment

            • Shaman0S
              Junior Member
              • Sep 2022
              • 11

              #6
              Also,

              But this memory is the total memory of the server, not the total memory used by docker.
              That's true and by design. You may want to look into Memory usage items for your containers as stacked graph. It will bring you overall picture of memory consumption by containers (similar to `docker stats`output)​

              Comment

              • s3ct0r
                Junior Member
                • Feb 2024
                • 6

                #7
                Yes, i already have the graphs for the single containers,
                but i need a new graph to the Total Memory of all the containers all together
                Do you have any stuff regarding this?
                Sure i can make a script and add a new item on the specific host, but its a custom config, it would be great to have this feature by default on the template.

                Comment

                • Shaman0S
                  Junior Member
                  • Sep 2022
                  • 11

                  #8
                  Have nothing like that. Available memory on a host plus individual containers' stats work fine for me.

                  Comment

                  • s3ct0r
                    Junior Member
                    • Feb 2024
                    • 6

                    #9
                    Thanks Shaman0S,
                    i'll work on this, if i get a good result i'll share it here.

                    Comment

                    • s3ct0r
                      Junior Member
                      • Feb 2024
                      • 6

                      #10
                      Done with a custom script.
                      Click image for larger version

Name:	image.png
Views:	279
Size:	74.3 KB
ID:	478625
                      following the Script:
                      Code:
                      docker stats --no-stream --format 'table {{.MemUsage}}' | sed -n '1!p' | cut -d '/' -f1 | sed 's/GiB/ * 1024 MiB/;s/MiB/ * 1024 KiB/;s/KiB/ * 1024/; s/$/ +\\/; $a0' | bc | numfmt --to=iec-i --suffix=B

                      Comment

                      Working...