Ad Widget

Collapse

Discussion thread for official Zabbix Template Docker

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlexL
    Zabbix Certified Specialist
    Zabbix Certified Specialist
    • Aug 2019
    • 55

    #1

    Discussion thread for official Zabbix Template Docker


    This thread is designed to provide grounds for discussion of the official Zabbix Template for Docker.
    The template and details of the template is available in GIT repository: https://git.zabbix.com/projects/ZBX/...tes/app/docker

    Zabbix is always looking for ways to improve our services and to make our users happier.
    We pride ourselves on doing our best each and every day, but we know that there is always something more to learn.
    We would like to hear back from you to know what have you liked and what would you improve in the template.
  • eronisko
    Junior Member
    • Nov 2022
    • 1

    #2
    Thanks for this template.

    We'd like to use this to monitor our Swarm services. Is there anyway we could extend this template to include (additional?) calls to the Docker API, e.g. https://docs.docker.com/engine/api/v...on/ServiceList ?

    Comment

    • andrii.katsubo
      Junior Member
      • Jan 2023
      • 1

      #3
      Nice template! Is it possible to use it with Zabbix Agent 2 on Windows Server 2019?

      Comment

      • Shaman0S
        Junior Member
        • Sep 2022
        • 11

        #4
        Thanks for the thing, allowed me to move out from self-baked solution.

        The only thing I am missing is monitoring amount of threads/processes in a container.

        When you execute 'docker stats' you can see it in 'PIDS' column. Also this metric item exposed via Docker API since v1.23.

        It helped me and my colleagues to identify multiple thread-leaking apps in production. So I love to see it in one of upcoming releases and created feature request ZBXNEXT-8354

        Anyone who's missing that, please vote.

        Comment

        • DrMoe
          Junior Member
          • Apr 2023
          • 10

          #5
          Hi thanks for the template but it unfortunately doesnt work as expected with Docker swarm.

          It discovers the containers but since the naming in docker swarm is randomly generated.
          For example if you restart a set of containers it correctly detects that the container is down but cannot detect that the container is up because the Name of the container is not the same.

          Code:
          Example:
          curl -s --unix-socket /var/run/docker.sock [URL]http://dummy/containers/json[/URL] | jq '.[].Names'
          
          Example Output BEFORE restart:
          [
          "/servicefrontend.1.os4eb7466kac5yr55tr9oiz9k"
          ]
          [
          "/servicefrontend.2.f6aszyhb0du0xu8fehz520v9f"
          ]​
          
          Example: Output AFTER docker container restart:
          [
          "/servicefrontend.1.x1jhvjjf79r2e3nalz5kr0f45"
          ]
          [
          "/servicefrontend.2.5jrn722eh7dhj7n0h2bd0nr7k"
          ]​​
          Can this be fixed for docker swarm? it just needs to cut off the randomly generated part.

          So the discovery should only discover:

          servicefrontend.1
          servicefrontend.2
          Last edited by DrMoe; 13-11-2023, 14:58.

          Comment

          • gelowe
            Member
            • Jun 2008
            • 30

            #6
            I am having trouble getting Docker Template to work with Podman
            I get the error : dial unix /var/run/docker.sock: connect: permission denied.
            How do I allow Zabbix to read the socket file?​

            In podman the docker sock file is
            ls -lht /var/run/docker.sock
            lrwxrwxrwx 1 root root 23 Nov 29 2022 /var/run/docker.sock -> /run/podman/podman.sock
            ls -lht /run/podman/podman.sock
            srw-rw---- 1 root root 0 Nov 29 2022 /run/podman/podman.sock

            Comment

            • DrMoe
              Junior Member
              • Apr 2023
              • 10

              #7
              Originally posted by gelowe
              I am having trouble getting Docker Template to work with Podman
              I get the error : dial unix /var/run/docker.sock: connect: permission denied.
              How do I allow Zabbix to read the socket file?​

              In podman the docker sock file is
              ls -lht /var/run/docker.sock
              lrwxrwxrwx 1 root root 23 Nov 29 2022 /var/run/docker.sock -> /run/podman/podman.sock
              ls -lht /run/podman/podman.sock
              srw-rw---- 1 root root 0 Nov 29 2022 /run/podman/podman.sock
              Try
              usermod -a -G docker zabbix
              service zabbix-agent2 restart​

              Comment


              • gelowe
                gelowe commented
                Editing a comment
                There is no docker group on a server with Podman , so this won't work. I don't think creating the group will help either as podman does not recognize the docker group.

                I did find a way, by adding the zabbix group the the podman socket
                I copied /usr/lib/systemd/system/podman.socket to /etc/systemd/system/podman.socket
                I added line SocketGroup=zabbix


                [Unit]
                Description=Podman API Socket
                Documentation=manodman-system-service(1)

                [Socket]
                ListenStream=%t/podman/podman.sock
                SocketMode=0660
                SocketGroup=zabbix

                [Install]
                WantedBy=sockets.target

                then i reloaded systemd and restarted the socket
                systemctl daemon-reload
                systemctl restart podman.socket
                Last edited by gelowe; 16-11-2023, 15:27. Reason: added more information

              • markfree
                markfree commented
                Editing a comment
                This works for root, but if you try it with a rootless user, it fails with a chown error.
            • flajzi
              Junior Member
              • Nov 2023
              • 1

              #8
              I have interesting behavior of Docker plugin.

              When I try ping Docker service locally by Zabbix Agent 2, I receive "1":
              Code:
              zabbix_agent2 -t docker.ping -v
              ...
              2023/11/19 14:23:04.000723 [2] processing update request (1 requests)
              2023/11/19 14:23:04.000774 [2] registering new client
              2023/11/19 14:23:04.000781 Calling C function "new_global_regexp()"
              2023/11/19 14:23:04.000797 [2] adding new request for key: 'docker.ping'
              2023/11/19 14:23:04.000806 [2] created direct exporter task for plugin 'Docker' itemid:0 key 'docker.ping'
              2023/11/19 14:23:04.000823 [2] created configurator task for plugin Docker
              2023/11/19 14:23:04.000844 plugin Docker: executing configurator task
              2023/11/19 14:23:04.000904 executing direct exporter task for key 'docker.ping'
              2023/11/19 14:23:04.001422 executed direct exporter task for key 'docker.ping'
              docker.ping                                   [s|1]
              2023/11/19 14:23:04.001459 manager has been stopped​
              but when I do the same from remote Zabbix server by calling docker.ping to SAME Zabbix agent2 I get "0" and in log I see this:

              Code:
              2023/11/19 14:18:06.846904 received passive check request: 'docker.ping' from '172.16.238.2'
              2023/11/19 14:18:06.846955 [1] processing update request (1 requests)
              2023/11/19 14:18:06.846967 [1] adding new request for key: 'docker.ping'
              2023/11/19 14:18:06.846976 [1] created direct exporter task for plugin 'Docker' itemid:0 key 'docker.ping'
              2023/11/19 14:18:06.847006 executing direct exporter task for key 'docker.ping'
              2023/11/19 14:18:06.847140 executed direct exporter task for key 'docker.ping'
              2023/11/19 14:18:06.847174 sending passive check response: '0' to '172.16.238.2'
              ​
              Can anyone explain why is this happening?

              Comment

              • autumnwalker
                Junior Member
                • Nov 2024
                • 1

                #9
                Hello! Thank you for this Template!

                Is there a way to have this template monitor for updates available to individual containers?

                Comment

                • IgorPMAAA
                  Junior Member
                  • Nov 2024
                  • 1

                  #10
                  Hi, sorry I am new to Zabbix.

                  I have configured root-less docker in SLES15SP6 following this documentation.
                  Is there anything to adjust or another template to make it work with root-less docker?

                  Thanks

                  Comment

                  • gaoquan_yang
                    Junior Member
                    • Jul 2024
                    • 1

                    #11
                    hello.the container memory usage does not match docker stats command. do you have any suggestion ?thanks

                    Comment

                    • hadesinua
                      Junior Member
                      • Aug 2025
                      • 1

                      #12
                      Is there an active version available to monitor active only agents?

                      Comment

                      Working...