├── .github └── workflows │ ├── build.yml │ ├── releases.sh │ └── zabbix_agentd.conf ├── .gitignore ├── .gitpod.Dockerfile ├── .gitpod.yml ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── doc ├── logo_centos.png ├── logo_debian.png ├── logo_docker.png ├── logo_redhat.png ├── logo_ubuntu.png ├── zabbix-docker-container-cpu-graph.png ├── zabbix-docker-container-memory-graph.png └── zabbix-docker-container-state-graph.png ├── dockerfiles ├── amazonlinux │ └── Dockerfile ├── centos │ └── Dockerfile ├── debian │ └── Dockerfile ├── fedora │ └── Dockerfile ├── opensuse │ └── Dockerfile └── ubuntu │ └── Dockerfile ├── selinux └── zabbix-docker.te ├── src └── modules │ └── zabbix_module_docker │ ├── Makefile │ └── zabbix_module_docker.c └── template ├── UNTESTED-Zabbix-Template-App-Docker-as-host(3.x-only).xml ├── Zabbix-Template-App-Docker-Mesos-Marathon-Chronos.xml ├── Zabbix-Template-App-Docker-active.xml └── Zabbix-Template-App-Docker.xml /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Test and Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | test: 14 | name: CI tests 15 | runs-on: ubuntu-20.04 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v2 19 | 20 | - name: Docker Login 21 | uses: docker/login-action@v1.8.0 22 | with: 23 | username: ${{ secrets.DOCKER_HUB_LOGIN }} 24 | password: ${{ secrets.DOCKER_HUB_PASSWORD }} 25 | 26 | - name: Prepare Environment 27 | run: | 28 | sudo apt-get -qq update 29 | sudo ln -snf /usr/share/zoneinfo/UTC /etc/localtime 30 | sudo apt-get -qq --assume-yes install git automake autoconf gcc make pkg-config libpcre3-dev libjansson-dev 31 | 32 | - name: Build Zabbix binaries 33 | run: | 34 | ZABBIX_VERSION=release/5.4 35 | git clone -b ${ZABBIX_VERSION} --depth 1 https://git.zabbix.com/scm/zbx/zabbix.git ~/zabbix 36 | cd ~/zabbix/ 37 | ./bootstrap.sh 1>/dev/null 38 | ./configure --enable-agent 1>/dev/null 39 | make 40 | sudo make install 41 | zabbix_agentd --version 42 | 43 | - name: Build Docker module 44 | run: | 45 | cp -R $GITHUB_WORKSPACE/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ 46 | cd ~/zabbix/src/modules/zabbix_module_docker 47 | make 48 | cp zabbix_module_docker.so /tmp 49 | 50 | - name: Run Zabbix Agent with Docker module 51 | run: | 52 | sudo zabbix_agentd -c $GITHUB_WORKSPACE/.github/workflows/zabbix_agentd.conf 53 | 54 | - name: Run test container 55 | run: sudo docker run -d --name testcontainer -e ENV=env --rm alpine sleep 600 56 | 57 | - name: Test discovery 1 - zabbix_get -s 127.0.0.1 -k docker.discovery 58 | run: | 59 | NEED="testcontainer" 60 | RESP=$(zabbix_get -s 127.0.0.1 -k docker.discovery) 61 | if [[ ${RESP} != *${NEED}* ]]; then echo $RESP; exit 1; fi 62 | echo $RESP 63 | 64 | - name: Test discovery 2 - zabbix_get -s 127.0.0.1 -k docker.discovery[Config,Env,ENV=] 65 | run: | 66 | NEED="env" 67 | RESP=$(zabbix_get -s 127.0.0.1 -k docker.discovery[Config,Env,ENV=]) 68 | if [[ ${RESP} != *${NEED}* ]]; then echo $RESP; exit 1; fi 69 | echo $RESP 70 | 71 | - name: Test cpu - zabbix_get -s 127.0.0.1 -k docker.cpu[/testcontainer,system] 72 | run: | 73 | RESP=$(zabbix_get -s 127.0.0.1 -k docker.cpu[/testcontainer,system]) 74 | echo $RESP 75 | 76 | - name: Test mem - zabbix_get -s 127.0.0.1 -k docker.mem[/testcontainer,rss] 77 | run: | 78 | RESP=$(zabbix_get -s 127.0.0.1 -k docker.mem[/testcontainer,rss]) 79 | echo $RESP 80 | 81 | - name: Test up - zabbix_get -s 127.0.0.1 -k docker.up[/testcontainer] 82 | run: | 83 | RESP=$(zabbix_get -s 127.0.0.1 -k docker.up[/testcontainer]) 84 | echo $RESP 85 | 86 | - name: Test cstatus - zabbix_get -s 127.0.0.1 -k docker.cstatus[All] 87 | run: | 88 | NEED='^[0-9]+$' 89 | RESP=$(zabbix_get -s 127.0.0.1 -k docker.cstatus[All]) 90 | if ! [[ ${RESP} =~ ${NEED} ]]; then echo $RESP; exit 1; fi 91 | echo $RESP 92 | 93 | - name: Test istatus - zabbix_get -s 127.0.0.1 -k docker.istatus[All] 94 | run: | 95 | NEED='^[0-9]+$' 96 | RESP=$(zabbix_get -s 127.0.0.1 -k docker.istatus[All]) 97 | if ! [[ ${RESP} =~ ${NEED} ]]; then echo $RESP; exit 1; fi 98 | echo $RESP 99 | 100 | - name: Test vstatus - zabbix_get -s 127.0.0.1 -k docker.vstatus[All] 101 | run: | 102 | NEED='^[0-9]+$' 103 | RESP=$(zabbix_get -s 127.0.0.1 -k docker.vstatus[All]) 104 | if ! [[ ${RESP} =~ ${NEED} ]]; then echo $RESP; exit 1; fi 105 | echo $RESP 106 | 107 | - name: Test modver - zabbix_get -s 127.0.0.1 -k docker.modver 108 | run: | 109 | RESP=$(zabbix_get -s 127.0.0.1 -k docker.modver) 110 | echo $RESP 111 | 112 | - name: Zabbix agent logs 113 | run: cat /tmp/zabbix_agentd.log 114 | 115 | - name: Cgroups structure /sys/fs/cgroup/ 116 | run: find /sys/fs/cgroup/ -type f 117 | 118 | - name: Cgroups list /proc/cgroups 119 | run: cat /proc/cgroups 120 | 121 | - name: /proc/cmdline 122 | run: cat /proc/cmdline 123 | 124 | - name: cgroup versions 125 | run: grep cgroup /proc/filesystems 126 | 127 | - name: cgroup kernel config 128 | run: cat /boot/config-* | grep CGROUP | grep -v ^# 129 | 130 | - name: mounted cgroups 131 | run: mount | grep cgroup 132 | 133 | - name: Docker info 134 | run: sudo docker info 135 | 136 | build: 137 | name: Build binaries 138 | needs: test 139 | if: github.event_name == 'push' && github.ref == 'refs/heads/master' 140 | runs-on: ubuntu-20.04 141 | steps: 142 | - name: Checkout 143 | uses: actions/checkout@v2 144 | 145 | - name: Docker Login 146 | uses: docker/login-action@v1.8.0 147 | with: 148 | username: ${{ secrets.DOCKER_HUB_LOGIN }} 149 | password: ${{ secrets.DOCKER_HUB_PASSWORD }} 150 | 151 | - name: Build Binaries 152 | run: pwd && ls -lah .github/workflows/ && .github/workflows/releases.sh 153 | 154 | - name: List Artifacts 155 | run: find /tmp/ghpages/ -type f 156 | 157 | - name: Checkout gh-pages 158 | uses: actions/checkout@v2 159 | with: 160 | ref: gh-pages 161 | 162 | - name: Update Binaries 163 | run: cp -R /tmp/ghpages/* . 164 | 165 | - name: Commit Binaries 166 | uses: EndBug/add-and-commit@v6 167 | with: 168 | branch: gh-pages 169 | message: 'Binaries update by GitHub Action' 170 | 171 | -------------------------------------------------------------------------------- /.github/workflows/releases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # compile binary modules version for different systems, zabbix versions for gh-pages branch 4 | 5 | rm -rf /tmp/ghpages 6 | mkdir /tmp/ghpages 7 | 8 | read -d '' systems << EOF 9 | amazonlinux2,amazonlinux:2 10 | amazonlinux1,amazonlinux:1 11 | centos7,centos:7 12 | debian11,debian:11 13 | debian10,debian:10 14 | debian9,debian:9 15 | fedora35,fedora:35 16 | fedora34,fedora:34 17 | fedora33,fedora:33 18 | opensuse15,opensuse/leap:15 19 | opensuse42,opensuse/leap:42 20 | ubuntu20,ubuntu:20.04 21 | ubuntu18,ubuntu:18.04 22 | ubuntu16,ubuntu:16.04 23 | ubuntu14,ubuntu:14.04 24 | EOF 25 | 26 | set -e 27 | 28 | versions=(6.0 5.4 5.0 4.0) 29 | 30 | GREEN='\033[0;32m' 31 | NC='\033[0m' 32 | 33 | for system in ${systems[@]}; do 34 | 35 | sourceimage=$(echo ${system} | awk -F',' '{print $2}') 36 | destionationfolder=$(echo ${system} | awk -F',' '{print $1}') 37 | sourcefolder=$(echo ${system} | awk -F',' '{print $1}' | sed 's/[0-9]//g') 38 | sed -i -E "s#FROM .*#FROM ${sourceimage}#g" dockerfiles/${sourcefolder}/Dockerfile 39 | 40 | for version in ${versions[@]}; do 41 | 42 | echo "" 43 | echo -e "${GREEN}Module compilation for Zabbix ${version} on ${sourceimage}${NC}" 44 | mkdir -p /tmp/ghpages/${destionationfolder}/${version} 45 | docker build --rm=false \ 46 | --build-arg ZABBIX_VERSION=release/${version} \ 47 | -t local/zabbix-docker-module-compilation \ 48 | -f dockerfiles/${sourcefolder}/Dockerfile \ 49 | dockerfiles/${sourcefolder}/ 50 | 51 | docker run --rm \ 52 | -v /tmp/ghpages/${destionationfolder}/${version}:/tmp \ 53 | local/zabbix-docker-module-compilation \ 54 | cp /root/zabbix/src/modules/zabbix_module_docker/zabbix_module_docker.so /tmp/zabbix_module_docker.so 55 | 56 | done 57 | 58 | docker rm -f $(docker ps -aq) &>/dev/null 59 | docker system prune -f &>/dev/null 60 | 61 | done 62 | 63 | docker rmi -f local/zabbix-docker-module-compilation 64 | git checkout -- dockerfiles/* 65 | 66 | # hashing 67 | find /tmp/ghpages -type d \( ! -name . \) -exec bash -c "cd '{}' && find . -type f -name 'zabbix_module_docker.so' -exec bash -c \"md5sum zabbix_module_docker.so > md5sum.txt\" \;" \; 68 | find /tmp/ghpages -type d \( ! -name . \) -exec bash -c "cd '{}' && find . -type f -name 'zabbix_module_docker.so' -exec bash -c \"sha1sum zabbix_module_docker.so > sha1sum.txt\" \;" \; 69 | find /tmp/ghpages -type d \( ! -name . \) -exec bash -c "cd '{}' && find . -type f -name 'zabbix_module_docker.so' -exec bash -c \"sha256sum zabbix_module_docker.so > sha256sum.txt\" \;" \; 70 | find /tmp/ghpages -type f -empty -delete 71 | -------------------------------------------------------------------------------- /.github/workflows/zabbix_agentd.conf: -------------------------------------------------------------------------------- 1 | AllowRoot=1 2 | DebugLevel=5 3 | LogFile=/tmp/zabbix_agentd.log 4 | Hostname=Zabbix CI Test 5 | LoadModulePath=/tmp 6 | LoadModule=zabbix_module_docker.so 7 | Server=0.0.0.0/0 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # compiled module 2 | *.so 3 | 4 | # clangd cache 5 | .cache/ 6 | 7 | # compilation database 8 | compile_commands.json 9 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-full 2 | 3 | USER gitpod 4 | 5 | RUN sudo apt-get -q update && \ 6 | sudo apt-get install -yq autoconf automake bear libjansson-dev && \ 7 | sudo rm -rf /var/lib/apt/lists/* 8 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | tasks: 2 | - init: >- 3 | git clone --quiet https://git.zabbix.com/scm/zbx/zabbix.git --depth 1 --single-branch --branch release/5.0 /workspace/zabbix/ && 4 | cd /workspace/zabbix && 5 | ./bootstrap.sh && 6 | ./configure --enable-agent && 7 | cd - && 8 | bear make -C src/modules/zabbix_module_docker ZABBIX_SOURCE=/workspace/zabbix 9 | image: 10 | file: .gitpod.Dockerfile 11 | 12 | vscode: 13 | extensions: 14 | - llvm-vs-code-extensions.vscode-clangd 15 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changes 0.7.0 2 | - Zabbix JSON processing functions replaced with Jansson library, ([#152](https://github.com/monitoringartist/zabbix-docker-monitoring/pull/152), thanks to [@i-ky](https://github.com/i-ky)) 3 | 4 | # Changes 0.6.9 5 | - new item key docker.port.discovery 6 | 7 | # Changes 0.6.8 8 | - fixed docker.discovery for newer kernels 4.X ([#80](https://github.com/monitoringartist/zabbix-docker-monitoring/pull/80)) 9 | 10 | # Changes 0.6.7 11 | - fixed incorrect docker.cstatus/vstatus/istatus metric ([#74](https://github.com/monitoringartist/zabbix-docker-monitoring/issues/74)) 12 | - removed support for systemd - code has been moved to https://github.com/cavaliercoder/zabbix-module-systemd 13 | - added timeout for Docker socket query ([#73](https://github.com/monitoringartist/zabbix-docker-monitoring/issues/73)) 14 | - new item key docker.modver 15 | 16 | # Changes 0.6.6 17 | - fixed incorrect CPU multiplier in the template ([#30](https://github.com/monitoringartist/zabbix-docker-monitoring/issues/30)) - update your container CPU triggers 18 | - added total CPU utilization metric (current sum of user+system ticks) 19 | - total CPU utilization metric is used in the templates instead of user+system CPU utilization 20 | 21 | # Changes 0.6.5 22 | 23 | - fixed incorrect docker.vstatus metric ([#66](https://github.com/monitoringartist/zabbix-docker-monitoring/issues/66)) 24 | 25 | # Changes 0.6.4 26 | 27 | - added changelog ([#51](https://github.com/monitoringartist/zabbix-docker-monitoring/issues/51)) 28 | - compatibility with all zabbix module API versions 2.x/3.x ([#54](https://github.com/monitoringartist/zabbix-docker-monitoring/issues/54)) 29 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@monitoringartist.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | - Fork the repository. 4 | - Create a feature branch (`git checkout -b my-new-feature master`). 5 | - Commit your changes, preferring one commit per logical unit of work. Often times, this simply means having a single commit. 6 | - If applicable, update the documentation in the [README file](README.md). 7 | - In the vast majority of cases, you should test your bug fix/feature. 8 | - Push your branch (`git push origin my-new-feature`). 9 | - Create a new pull request. 10 | - Address any comments your reviewer raises, pushing additional commits onto your branch along the way. 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [Managed by Monitoring Artist: DevOps / Docker / Kubernetes / AWS ECS / Zabbix / Zenoss / Terraform / Monitoring](http://www.monitoringartist.com 'DevOps / Docker / Kubernetes / AWS ECS / Zabbix / Zenoss / Terraform / Monitoring') 2 | 3 | # Zabbix Docker Monitoring ![Build binaries](https://github.com/monitoringartist/zabbix-docker-monitoring/workflows/Test%20and%20Build/badge.svg) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/monitoringartist/zabbix-docker-monitoring) 4 | 5 | **Overview of Monitoring Artist (dockerized) monitoring ecosystem:** 6 | 7 | - **[Dockbix XXL](https://hub.docker.com/r/monitoringartist/dockbix-xxl/)** - Zabbix server/proxy/UI/snmpd/java gateway with additional extensions 8 | - **[Dockbix agent XXL](https://hub.docker.com/r/monitoringartist/dockbix-agent-xxl-limited/)** - Zabbix agent with [Docker (Kubernetes/Mesos/Chronos/Marathon) monitoring](https://github.com/monitoringartist/zabbix-docker-monitoring) module 9 | - **[Zabbix templates](https://hub.docker.com/r/monitoringartist/zabbix-templates/)** - tiny Docker image for simple template deployment of selected Zabbix monitoring templates 10 | - **[Zabbix extension - all templates](https://hub.docker.com/r/monitoringartist/zabbix-ext-all-templates/)** - storage image for Dockbix XXL with 200+ [community templates](https://github.com/monitoringartist/zabbix-community-repos) 11 | - **[Kubernetized Zabbix](https://github.com/monitoringartist/kubernetes-zabbix)** - containerized Zabbix cluster based on Kubernetes 12 | - **[Grafana XXL](https://hub.docker.com/r/monitoringartist/grafana-xxl/)** - dockerized Grafana with all community plugins 13 | - **[Grafana dashboards](https://grafana.net/monitoringartist)** - Grafana dashboard collection for [AWS](https://github.com/monitoringartist/grafana-aws-cloudwatch-dashboards) and [Zabbix](https://github.com/monitoringartist/grafana-zabbix-dashboards) 14 | - **[Monitoring Analytics](https://hub.docker.com/r/monitoringartist/monitoring-analytics/)** - graphic analytic tool for Zabbix data from data scientists 15 | - **[Docker killer](https://hub.docker.com/r/monitoringartist/docker-killer/)** - Docker image for Docker stress and Docker orchestration testing 16 | 17 | ---- 18 | 19 | Monitoring of Docker container by using Zabbix. Available CPU, mem, 20 | blkio, net container metrics and some containers config details, e.g. IP, name, ... 21 | Zabbix Docker module has native support for Docker containers (Systemd included) 22 | and should also support a few other container types (e.g. LXC) out of the box. 23 | Please feel free to test and provide feedback/open issue. 24 | The module is focused on performance, see section 25 | [Module vs. UserParameter script](#module-vs-userparameter-script). 26 | 27 | Module is available also as a part of different GitHub project - Docker image 28 | [dockbix-agent-xxl-limited](https://hub.docker.com/r/monitoringartist/dockbix-agent-xxl-limited/) 29 | (OS Linux host metrics and other selected metrics are supported as well). Quickstart: 30 | 31 | [![Dockbix Agent XXL Docker container](https://raw.githubusercontent.com/monitoringartist/dockbix-agent-xxl/master/doc/dockbix-agent-xxl.gif)](https://github.com/monitoringartist/dockbix-agent-xxl) 32 | 33 | ```bash 34 | docker run \ 35 | --name=dockbix-agent-xxl \ 36 | --net=host \ 37 | --privileged \ 38 | -v /:/rootfs \ 39 | -v /var/run:/var/run \ 40 | --restart unless-stopped \ 41 | -e "ZA_Server=" \ 42 | -e "ZA_ServerActive=" \ 43 | -d monitoringartist/dockbix-agent-xxl-limited:latest 44 | ``` 45 | 46 | For more information, visit [Dockbix agent XXL with Docker monitoring support](https://github.com/monitoringartist/dockbix-agent-xxl). 47 | 48 | Please donate to the author, so he can continue to publish other awesome projects 49 | for free: 50 | 51 | [![Paypal donate button](http://jangaraj.com/img/github-donate-button02.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8LB6J222WRUZ4) 52 | 53 | # Installation 54 | 55 | * Import provided template [Zabbix-Template-App-Docker.xml](https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/template/Zabbix-Template-App-Docker.xml). 56 | * Configure your Zabbix agent(s) - load downloaded (see table below) or your 57 | [compiled](#compilation) `zabbix_module_docker.so`
58 | https://www.zabbix.com/documentation/3.0/manual/config/items/loadablemodules 59 | 60 | Available templates: 61 | 62 | - [Zabbix-Template-App-Docker.xml](https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/template/Zabbix-Template-App-Docker.xml) - standard (recommended) template 63 | - [Zabbix-Template-App-Docker-active.xml](https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/template/Zabbix-Template-App-Docker-active.xml) - standard template with active checks 64 | - [Zabbix-Template-App-Docker-Mesos-Marathon-Chronos.xml](https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/template/Zabbix-Template-App-Docker-Mesos-Marathon-Chronos.xml) - template for monitoring of Docker containers in Mesos cluster (Marathon/Chronos) 65 | 66 | You can use Docker image [monitoringartist/zabbix-templates](https://hub.docker.com/r/monitoringartist/zabbix-templates/) for import of Zabbix-Template-App-Docker.xml template. For example: 67 | 68 | ```bash 69 | docker run --rm \ 70 | -e XXL_apiurl=http://zabbix.org/zabbix \ 71 | -e XXL_apiuser=Admin \ 72 | -e XXL_apipass=zabbix \ 73 | monitoringartist/zabbix-templates 74 | ``` 75 | 76 | Download latest build of `zabbix_module_docker.so` for Zabbix 6.0/5.4/5.0/4.0 agents: 77 | 78 | | OS | Zabbix 6.0 | Zabbix 5.4 | Zabbix 5.0 | Zabbix 4.0 | 79 | | ------------ | :--------: | :--------: | :--------: | :--------: | 80 | | Amazon Linux 2 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/amazonlinux2/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/amazonlinux2/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/amazonlinux2/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/amazonlinux2/4.0/zabbix_module_docker.so) | 81 | | Amazon Linux 1 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/amazonlinux1/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/amazonlinux1/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/amazonlinux1/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/amazonlinux1/4.0/zabbix_module_docker.so) | 82 | | CentOS 7 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/centos7/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/centos7/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/centos7/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/centos7/4.0/zabbix_module_docker.so) | 83 | | Debian 11 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian11/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian11/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian11/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian11/4.0/zabbix_module_docker.so) | 84 | | Debian 10 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian10/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian10/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian10/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian10/4.0/zabbix_module_docker.so) | 85 | | Debian 9 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian9/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian9/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian9/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/debian9/4.0/zabbix_module_docker.so) | 86 | | Fedora 35 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora35/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora35/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora35/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora35/4.0/zabbix_module_docker.so) | 87 | | Fedora 34 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora34/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora34/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora34/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora34/4.0/zabbix_module_docker.so) | 88 | | Fedora 33 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora33/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora33/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora33/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/fedora33/4.0/zabbix_module_docker.so) | 89 | | openSUSE 15 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/opensuse15/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/opensuse15/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/opensuse15/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/opensuse15/4.0/zabbix_module_docker.so) | 90 | | openSUSE 42 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/opensuse42/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/opensuse42/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/opensuse42/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/opensuse42/4.0/zabbix_module_docker.so) | 91 | | RHEL 7 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/centos7/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/centos7/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/centos7/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/centos7/4.0/zabbix_module_docker.so) | 92 | | Ubuntu 20 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu20/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu20/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu20/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu20/4.0/zabbix_module_docker.so) | 93 | | Ubuntu 18 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu18/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu18/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu18/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu18/4.0/zabbix_module_docker.so) | 94 | | Ubuntu 16 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu16/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu16/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu16/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu16/4.0/zabbix_module_docker.so) | 95 | | Ubuntu 14 | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu14/6.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu14/5.4/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu14/5.0/zabbix_module_docker.so) | [Download](https://github.com/monitoringartist/zabbix-docker-monitoring/raw/gh-pages/ubuntu14/4.0/zabbix_module_docker.so) | 96 | 97 | If the provided build doesn't work on your system, please see section [Compilation](#compilation). 98 | You can check [folder dockerfiles](https://github.com/monitoringartist/zabbix-docker-monitoring/tree/master/dockerfiles), 99 | where Dockerfiles for different OS/Zabbix versions can be customised. 100 | 101 | # Grafana dashboard 102 | 103 | Custom Grafana dashboard for Docker monitoring with used Zabbix Docker (Mesos, Marathon/Chronos) templates are available in [Grafana Zabbix dashboards repo](https://github.com/monitoringartist/grafana-zabbix-dashboards). 104 | 105 | ![Grafana dashboard Overview Docker](https://raw.githubusercontent.com/monitoringartist/grafana-zabbix-dashboards/master/overview-docker/overview-docker.png) 106 | 107 | # Available metrics 108 | 109 | Note: cid - container ID, two options are available: 110 | 111 | - full container ID (macro *{#FCONTAINERID}*), e.g. 112 | *2599a1d88f75ea2de7283cbf469ea00f0e5d42aaace95f90ffff615c16e8fade* 113 | - human name or short container ID (macros *{#HCONTAINERID}* or *{#SCONTAINERID}*) - prefix "/" must be used, e.g. 114 | */zabbix-server* or */2599a1d88f75* 115 | 116 | | Key | Description | 117 | | --- | ----------- | 118 | | **docker.discovery[\,\,\]** | **LLD container discovering:**
Only running containers are discovered.
[Additional Docker permissions](#additional-docker-permissions) are needed when you want to see container name (human name) in metrics/graphs instead of short container ID. Optional parameters are used for definition of HCONTAINERID - docker.inspect function will be used in this case.
For example:
*docker.discovery[Config,Env,MESOS_TASK_ID=]* is recommended for Mesos/Chronos/Marathon container monitoring
Note 1: *docker.discovery* is faster version of *docker.discovery[Name]*
Note 2: Available macros:
*{#FCONTAINERID}* - full container ID (64 character string)
*{#SCONTAINERID}* - short container ID (12 character string)
*{#HCONTAINERID}* - human name of container
*{#SYSTEM.HOSTNAME}* - system hostname | 119 | | **docker.port.discovery[cid,\]** | **LLD published container port dicovering:**
**protocol** - port protocol, which should be discovered, default value *all*, available protocols: *tcp,udp* | 120 | | **docker.mem[cid,mmetric]** | **Memory metrics:**
**mmetric** - any available memory metric in the pseudo-file memory.stat, e.g.: *cache, rss, mapped_file, pgpgin, pgpgout, swap, pgfault, pgmajfault, inactive_anon, active_anon, inactive_file, active_file, unevictable, hierarchical_memory_limit, hierarchical_memsw_limit, total_cache, total_rss, total_mapped_file, total_pgpgin, total_pgpgout, total_swap, total_pgfault, total_pgmajfault, total_inactive_anon, total_active_anon, total_inactive_file, total_active_file, total_unevictable*, Note: if you have a problem with memory metrics, be sure that memory cgroup subsystem is enabled - kernel parameter: *cgroup_enable=memory* | 121 | | **docker.cpu[cid,cmetric]** | **CPU metrics:**
**cmetric** - any available CPU metric in the pseudo-file cpuacct.stat/cpu.stat, e.g.: *system, user, total (current sum of system/user* or container [throttling metrics](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/sec-cpu.html): *nr_throttled, throttled_time*
Note: CPU user/system/total metrics must be recalculated to % utilization value by Zabbix - *Delta (speed per second)*. | 122 | | **docker.dev[cid,bfile,bmetric]** | **Blk IO metrics:**
**bfile** - container blkio pseudo-file, e.g.: *blkio.io_merged, blkio.io_queued, blkio.io_service_bytes, blkio.io_serviced, blkio.io_service_time, blkio.io_wait_time, blkio.sectors, blkio.time, blkio.avg_queue_size, blkio.idle_time, blkio.dequeue, ...*
**bmetric** - any available blkio metric in selected pseudo-file, e.g.: *Total*. Option for selected block device only is also available e.g. *'8:0 Sync'* (quotes must be used in key parameter in this case)
Note: Some pseudo blkio files are available only if kernel config *CONFIG_DEBUG_BLK_CGROUP=y*, see recommended docs. | 123 | | **docker.inspect[cid,par1,\,\]** | **Docker inspection:**
Requested value from Docker inspect JSON object (e.g. [API v1.21](http://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/#inspect-a-container)) is returned.
**par1** - name of 1st level JSON property
**par2** - optional name of 2nd level JSON property
**par3** - optional name of 3rd level JSON property or selector of item in the JSON array
For example:
*docker.inspect[cid,Config,Image], docker.inspect[cid,NetworkSettings,IPAddress], docker.inspect[cid,Config,Env,MESOS_TASK_ID=], docker.inspect[cid,State,StartedAt], docker.inspect[cid,Name]*
Note 1: Requested value must be plain text/numeric value. JSON objects and booleans are not supported.
Note 2: [Additional Docker permissions](#additional-docker-permissions) are needed.
Note 3: If you use selector for selecting value in array, then selector string is removed from returned value. | 124 | | **docker.info[info]** | **Docker information:**
Requested value from Docker info JSON object (e.g. [API v1.21](http://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/#display-system-wide-information)) is returned.
**info** - name of requested information, e.g. *Containers, Images, NCPU, ...*
Note: [Additional Docker permissions](#additional-docker-permissions) are needed. | 125 | | **docker.stats[cid,par1,\,\]** | **Docker container resource usage statistics:**
Docker version 1.5+ is required
Requested value from Docker stats JSON object (e.g. [API v1.21](http://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/#get-container-stats-based-on-resource-usage)) is returned.
**par1** - name of 1st level JSON property
**par2** - optional name of 2nd level JSON property
**par3** - optional name of 3rd level JSON property
For example:
*docker.stats[cid,memory_stats,usage], docker.stats[cid,network,rx_bytes], docker.stats[cid,cpu_stats,cpu_usage,total_usage]*
Note 1: Requested value must be plain text/numeric value. JSON objects/arrays are not supported.
Note 2: [Additional Docker permissions](#additional-docker-permissions) are needed.
Note 3: The most accurate way to get Docker container stats, but it's also the slowest (0.3-0.7s), because data are readed from on demand container stats stream. | 126 | | **docker.cstatus[status]** | **Count of Docker containers in defined status:**
**status** - container status, available statuses:
*All* - count of all containers
*Up* - count of running containers (Paused included)
*Exited* - count of exited containers
*Crashed* - count of crashed containers (exit code != 0)
*Paused* - count of paused containers
Note: [Additional Docker permissions](#additional-docker-permissions) are needed.| 127 | | **docker.istatus[status]** | **Count of Docker images in defined status:**
**status** - image status, available statuses:
*All* - all images
*Dangling* - count of dangling images
Note: [Additional Docker permissions](#additional-docker-permissions) are needed.| 128 | | **docker.vstatus[status]** | **Count of Docker volumes in defined status:**
**status** - volume status, available statuses:
*All* - all volumes
*Dangling* - count of dangling volumes
Note 1: [Additional Docker permissions](#additional-docker-permissions) are needed.
Note2: Docker API v1.21+ is required| 129 | | **docker.up[cid]** | **Running state check:**
1 if container is running, otherwise 0 | 130 | | **docker.modver** | Version of the loaded docker module | 131 | | | | 132 | | **docker.xnet[cid,interface,nmetric]** | **Network metrics (experimental):**
**interface** - name of interface, e.g. eth0, if name is *all*, then sum of selected metric across all interfaces is returned (`lo` included)
**nmetric** - any available network metric name from output of command netstat -i:
*MTU, Met, RX-OK, RX-ERR, RX-DRP, RX-OVR, TX-OK, TX-ERR, TX-DRP, TX-OVR*
For example:
*docker.xnet[cid,eth0,TX-OK]
docker.xnet[cid,all,RX-ERR]*
Note 1: [Root permissions (AllowRoot=1)](#additional-docker-permissions) are required, because net namespaces (`/var/run/netns/`) are created/used
Note 2: **netstat** is needed to be installed and available in PATH| 133 | 134 | Container log monitoring 135 | ======================== 136 | 137 | [Standard Zabbix log monitoring](https://www.zabbix.com/documentation/3.0/manual/config/items/itemtypes/log_items) 138 | can be used. Keep in mind, that Zabbix agent must support active mode for log 139 | monitoring. Stdout/stderr Docker container console output is logged by Docker 140 | into file */var/lib/docker/containers/\/\-json.log* (fid - full container 141 | ID = macro *{#FCONTAINERID}*). If the application in container is not able to 142 | log to stdout/stderr, link log file to stdout/stderr. For example: 143 | 144 | ```bash 145 | ln -sf /dev/stdout /var/log/nginx/access.log 146 | ln -sf /dev/stderr /var/log/nginx/error.log 147 | ``` 148 | 149 | Example of *-json* log file: 150 | 151 | ``` 152 | {"log":"2015-07-03 00:15:05,870 DEBG fd 13 closed, stopped monitoring \u003cPOutputDispatcher at 37974528 for \u003cSubprocess at 37493936 with name php-fpm in state STARTING\u003e (stdout)\u003e\n","stream":"stdout","time":"2015-07-03T00:15:05.871956756Z"} 153 | {"log":"2015-07-03 00:15:05,873 DEBG fd 17 closed, stopped monitoring \u003cPOutputDispatcher at 37974240 for \u003cSubprocess at 37493936 with name php-fpm in state STARTING\u003e (stderr)\u003e\n","stream":"stdout","time":"2015-07-03T00:15:05.875886957Z"} 154 | {"log":"2015-07-03 00:15:06,878 INFO success: nginx entered RUNNING state, process has stayed up for \u003e than 1 seconds (startsecs)\n","stream":"stdout","time":"2015-07-03T00:15:06.882435459Z"} 155 | {"log":"2015-07-03 00:15:06,879 INFO success: nginx-reload entered RUNNING state, process has stayed up for \u003e than 1 seconds (startsecs)\n","stream":"stdout","time":"2015-07-03T00:15:06.882548486Z"} 156 | ``` 157 | 158 | Recommended Zabbix log key for this case: 159 | 160 | ``` 161 | log[/var/lib/docker/containers//-json.log,"\"log\":\"(.*)\",\"stream",,,skip,\1] 162 | ``` 163 | 164 | You can utilize Zabbix LLD for automatic Docker container log monitoring. In this case it'll be: 165 | 166 | ``` 167 | log[/var/lib/docker/containers/{#FCONTAINERID}/{#FCONTAINERID}-json.log,"\"log\":\"(.*)\",\"stream",,,skip,\1] 168 | ``` 169 | 170 | Images 171 | ====== 172 | 173 | Docker container CPU graph in Zabbix: 174 | ![Docker container CPU graph in Zabbix](https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/doc/zabbix-docker-container-cpu-graph.png) 175 | Docker container memory graph in Zabbix: 176 | ![Docker container memory graph in Zabbix](https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/doc/zabbix-docker-container-memory-graph.png) 177 | Docker container state graph in Zabbix: 178 | ![Docker container state graph in Zabbix](https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/doc/zabbix-docker-container-state-graph.png) 179 | 180 | Additional Docker permissions 181 | ============================= 182 | 183 | You have two options, how to get additional Docker permissions: 184 | 185 | - Add zabbix user to docker group (recommended option): 186 | 187 | ```bash 188 | usermod -aG docker zabbix 189 | ``` 190 | 191 | **Or** 192 | 193 | - Edit zabbix_agentd.conf and set AllowRoot (Zabbix agent with root 194 | permissions): 195 | 196 | ```bash 197 | AllowRoot=1 198 | ``` 199 | 200 | Note: If you use Docker from RHEL/Centos repositories, then you have to 201 | use *AllowRoot=1* option. 202 | 203 | SELinux 204 | ------- 205 | If you are on a system that has `SELinux` in enforcing-mode (check with `getenforce`), you can make it work with this SELinux module. This module will persist reboots. Save it, then run: 206 | 207 | ```bash 208 | wget https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/selinux/zabbix-docker.te 209 | checkmodule -M -m -o zabbix-docker.mod zabbix-docker.te 210 | semodule_package -o zabbix-docker.pp -m zabbix-docker.mod 211 | semodule -i zabbix-docker.pp 212 | ``` 213 | 214 | Compilation 215 | =========== 216 | 217 | You have to compile the module if provided binary doesn't work on your system. 218 | Basic compilation steps (please use right Zabbix branch version): 219 | 220 | ```bash 221 | # Required CentOS/RHEL apps: yum install -y wget autoconf automake gcc git pcre-devel jansson-devel 222 | # Required Debian/Ubuntu apps: apt-get install -y wget autoconf automake gcc git make pkg-config libpcre3-dev libjansson-dev 223 | # Required Fedora apps: dnf install -y wget autoconf automake gcc git make pcre-devel jansson-devel 224 | # Required openSUSE apps: zypper install -y wget autoconf automake gcc git make pkg-config pcre-devel libjansson-devel 225 | # Required Gentoo apps 1: emerge net-misc/wget sys-devel/autoconf sys-devel/automake sys-devel/gcc 226 | # Required Gentoo apps 2: emerge dev-vcs/git sys-devel/make dev-util/pkgconfig dev-libs/libpcre dev-libs/jansson 227 | # Source, use your version: git clone -b 4.2.2 --depth 1 https://github.com/zabbix/zabbix.git /usr/src/zabbix 228 | cd /usr/src/zabbix 229 | ./bootstrap.sh 230 | ./configure --enable-agent 231 | mkdir src/modules/zabbix_module_docker 232 | cd src/modules/zabbix_module_docker 233 | wget https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/src/modules/zabbix_module_docker/zabbix_module_docker.c 234 | wget https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/src/modules/zabbix_module_docker/Makefile 235 | make 236 | ``` 237 | 238 | The output will be the binary file (dynamically linked shared object library) `zabbix_module_docker.so`, which can be loaded by Zabbix agent. 239 | 240 | You can also use Docker for compilation. Example of Dockerfiles, which have been prepared for module compilation - https://github.com/monitoringartist/zabbix-docker-monitoring/tree/master/dockerfiles 241 | 242 | Troubleshooting 243 | =============== 244 | 245 | Edit your zabbix_agentd.conf and set DebugLevel: 246 | 247 | DebugLevel=4 248 | 249 | Module debugs messages will be available in standard zabbix_agentd.log. 250 | 251 | Issues and feature requests 252 | =========================== 253 | 254 | Please use Github issue tracker. 255 | 256 | Module vs. UserParameter script 257 | =============================== 258 | 259 | The module is ~10x quicker because it's compiled the binary code. 260 | I've used my project [Zabbix agent stress test](https://github.com/monitoringartist/zabbix-agent-stress-test) 261 | for performance tests. 262 | 263 | Part of config in zabbix_agentd.conf: 264 | 265 | UserParameter=xdocker.cpu[*],grep $2 /cgroup/cpuacct/docker/$1/cpuacct.stat | awk '{print $$2}' 266 | LoadModule=zabbix_module_docker.so 267 | 268 | Tests: 269 | 270 | [root@dev zabbix-agent-stress-test]# ./zabbix-agent-stress-test.py -s 127.0.0.1 -k "xdocker.cpu[d5bf68ec1fb570d8ac3047226397edd8618eed14278ce035c98fbceef02d7730,system]" -t 20 271 | Warning: you are starting more threads, than your system has available CPU cores (4)! 272 | Starting 20 threads, host: 127.0.0.1:10050, key: xdocker.cpu[d5bf68ec1fb570d8ac3047226397edd8618eed14278ce035c98fbceef02d7730,system] 273 | Success: 291 Errors: 0 Avg speed: 279.68 qps Execution time: 1.00 sec 274 | Success: 548 Errors: 0 Avg speed: 349.04 qps Execution time: 2.00 sec 275 | Success: 803 Errors: 0 Avg speed: 282.72 qps Execution time: 3.00 sec 276 | Success: 1060 Errors: 0 Avg speed: 209.31 qps Execution time: 4.00 sec 277 | Success: 1310 Errors: 0 Avg speed: 187.14 qps Execution time: 5.00 sec 278 | Success: 1570 Errors: 0 Avg speed: 178.80 qps Execution time: 6.01 sec 279 | Success: 1838 Errors: 0 Avg speed: 189.36 qps Execution time: 7.01 sec 280 | Success: 2106 Errors: 0 Avg speed: 225.68 qps Execution time: 8.01 sec 281 | Success: 2382 Errors: 0 Avg speed: 344.51 qps Execution time: 9.01 sec 282 | Success: 2638 Errors: 0 Avg speed: 327.88 qps Execution time: 10.01 sec 283 | Success: 2905 Errors: 0 Avg speed: 349.93 qps Execution time: 11.01 sec 284 | Success: 3181 Errors: 0 Avg speed: 352.23 qps Execution time: 12.01 sec 285 | Success: 3450 Errors: 0 Avg speed: 239.38 qps Execution time: 13.01 sec 286 | Success: 3678 Errors: 0 Avg speed: 209.88 qps Execution time: 14.02 sec 287 | Success: 3923 Errors: 0 Avg speed: 180.30 qps Execution time: 15.02 sec 288 | Success: 4178 Errors: 0 Avg speed: 201.58 qps Execution time: 16.02 sec 289 | Success: 4434 Errors: 0 Avg speed: 191.92 qps Execution time: 17.02 sec 290 | Success: 4696 Errors: 0 Avg speed: 332.06 qps Execution time: 18.02 sec 291 | Success: 4968 Errors: 0 Avg speed: 325.55 qps Execution time: 19.02 sec 292 | Success: 5237 Errors: 0 Avg speed: 325.61 qps Execution time: 20.02 sec 293 | ^C 294 | Success: 5358 Errors: 0 Avg rate: 192.56 qps Execution time: 20.53 sec 295 | Avg rate based on total execution time and success connections: 261.02 qps 296 | 297 | [root@dev zabbix-agent-stress-test]# ./zabbix-agent-stress-test.py -s 127.0.0.1 -k "docker.cpu[d5bf68ec1fb570d8ac3047226397edd8618eed14278ce035c98fbceef02d7730,system]" -t 20 298 | Warning: you are starting more threads, than your system has available CPU cores (4)! 299 | Starting 20 threads, host: 127.0.0.1:10050, key: docker.cpu[d5bf68ec1fb570d8ac3047226397edd8618eed14278ce035c98fbceef02d7730,system] 300 | Success: 2828 Errors: 0 Avg speed: 2943.98 qps Execution time: 1.00 sec 301 | Success: 5095 Errors: 0 Avg speed: 1975.77 qps Execution time: 2.01 sec 302 | Success: 7623 Errors: 0 Avg speed: 2574.55 qps Execution time: 3.01 sec 303 | Success: 10098 Errors: 0 Avg speed: 4720.20 qps Execution time: 4.02 sec 304 | Success: 12566 Errors: 0 Avg speed: 3423.56 qps Execution time: 5.02 sec 305 | Success: 14706 Errors: 0 Avg speed: 2397.01 qps Execution time: 6.03 sec 306 | Success: 17128 Errors: 0 Avg speed: 903.63 qps Execution time: 7.05 sec 307 | Success: 19520 Errors: 0 Avg speed: 2663.53 qps Execution time: 8.05 sec 308 | Success: 21899 Errors: 0 Avg speed: 1516.36 qps Execution time: 9.07 sec 309 | Success: 24219 Errors: 0 Avg speed: 3570.47 qps Execution time: 10.07 sec 310 | Success: 26676 Errors: 0 Avg speed: 1204.58 qps Execution time: 11.08 sec 311 | Success: 29162 Errors: 0 Avg speed: 2719.87 qps Execution time: 12.08 sec 312 | Success: 31671 Errors: 0 Avg speed: 2265.67 qps Execution time: 13.08 sec 313 | Success: 34186 Errors: 0 Avg speed: 3490.64 qps Execution time: 14.08 sec 314 | Success: 36749 Errors: 0 Avg speed: 2094.59 qps Execution time: 15.09 sec 315 | Success: 39047 Errors: 0 Avg speed: 3213.35 qps Execution time: 16.09 sec 316 | Success: 41361 Errors: 0 Avg speed: 3171.67 qps Execution time: 17.09 sec 317 | Success: 43739 Errors: 0 Avg speed: 3946.53 qps Execution time: 18.09 sec 318 | Success: 46100 Errors: 0 Avg speed: 1308.88 qps Execution time: 19.09 sec 319 | Success: 48556 Errors: 0 Avg speed: 2663.52 qps Execution time: 20.09 sec 320 | ^C 321 | Success: 49684 Errors: 0 Avg rate: 2673.85 qps Execution time: 20.52 sec 322 | Avg rate based on total execution time and success connections: 2420.70 qps 323 | 324 | Results of 20s stress test: 325 | 326 | | StartAgent value | Module qps | UserParameter script qps | 327 | | ---------------- | ---------- | ------------------------ | 328 | | 3 | 2420.70 | 261.02 | 329 | | 10 | 2612.20 | 332.62 | 330 | | 20 | 2487.93 | 348.52 | 331 | 332 | Discovery test: 333 | 334 | Part of config in zabbix_agentd.conf: 335 | 336 | UserParameter=xdocker.discovery,/etc/zabbix/scripts/container_discover.sh 337 | LoadModule=zabbix_module_docker.so 338 | 339 | Shell implementation container_discover.sh: 340 | 341 | Test with 237 running containers: 342 | 343 | [root@dev ~]# docker info 344 | Containers: 237 345 | Images: 121 346 | Storage Driver: btrfs 347 | Execution Driver: native-0.2 348 | Kernel Version: 3.10.0-229.el7.x86_64 349 | Operating System: Red Hat Enterprise Linux Server 7.1 (Maipo) 350 | CPUs: 10 351 | Total Memory: 62.76 GiB 352 | Name: dev.local 353 | ID: AOAM:BO3G:5MCE:5FMM:IWKP:NPM4:PRKV:ZZ34:BYFL:XGAV:SRNJ:LKDH 354 | Username: username 355 | Registry: [https://index.docker.io/v1/] 356 | [root@dev ~]# time zabbix_get -s 127.0.0.1 -k docker.discovery > /dev/null 357 | 358 | real 0m0.112s 359 | user 0m0.000s 360 | sys 0m0.003s 361 | [root@dev ~]# time zabbix_get -s 127.0.0.1 -k xdocker.discovery > /dev/null 362 | 363 | real 0m5.856s 364 | user 0m0.000s 365 | sys 0m0.002s 366 | [root@dev ~]# ./zabbix-agent-stress-test.py -s 127.0.0.1 -k xdocker.discovery 367 | Starting 1 threads, host: 127.0.0.1:10050, key: xdocker.discovery 368 | Success: 0 Errors: 0 Avg rate: 0.00 qps Execution time: 1.00 sec 369 | Success: 0 Errors: 0 Avg rate: 0.00 qps Execution time: 2.00 sec 370 | Success: 0 Errors: 0 Avg rate: 0.00 qps Execution time: 3.02 sec 371 | Success: 0 Errors: 0 Avg rate: 0.00 qps Execution time: 4.02 sec 372 | Success: 0 Errors: 0 Avg rate: 0.00 qps Execution time: 5.02 sec 373 | Success: 1 Errors: 0 Avg rate: 0.10 qps Execution time: 6.02 sec 374 | Success: 1 Errors: 0 Avg rate: 0.10 qps Execution time: 7.02 sec 375 | Success: 1 Errors: 0 Avg rate: 0.10 qps Execution time: 8.02 sec 376 | Success: 1 Errors: 0 Avg rate: 0.10 qps Execution time: 9.02 sec 377 | Success: 1 Errors: 0 Avg rate: 0.10 qps Execution time: 10.02 sec 378 | Success: 2 Errors: 0 Avg rate: 0.14 qps Execution time: 11.02 sec 379 | Success: 2 Errors: 0 Avg rate: 0.14 qps Execution time: 12.03 sec 380 | Success: 2 Errors: 0 Avg rate: 0.14 qps Execution time: 13.03 sec 381 | Success: 2 Errors: 0 Avg rate: 0.14 qps Execution time: 14.03 sec 382 | Success: 2 Errors: 0 Avg rate: 0.14 qps Execution time: 15.03 sec 383 | Success: 3 Errors: 0 Avg rate: 0.16 qps Execution time: 16.03 sec 384 | Success: 3 Errors: 0 Avg rate: 0.16 qps Execution time: 17.03 sec 385 | Success: 3 Errors: 0 Avg rate: 0.16 qps Execution time: 18.03 sec 386 | Success: 3 Errors: 0 Avg rate: 0.16 qps Execution time: 19.03 sec 387 | Success: 3 Errors: 0 Avg rate: 0.16 qps Execution time: 20.03 sec 388 | Success: 3 Errors: 0 Avg rate: 0.16 qps Execution time: 21.04 sec 389 | Success: 4 Errors: 0 Avg rate: 0.17 qps Execution time: 22.04 sec 390 | Success: 4 Errors: 0 Avg rate: 0.17 qps Execution time: 23.04 sec 391 | Success: 4 Errors: 0 Avg rate: 0.17 qps Execution time: 24.04 sec 392 | Success: 4 Errors: 0 Avg rate: 0.17 qps Execution time: 25.05 sec 393 | Success: 5 Errors: 0 Avg rate: 0.20 qps Execution time: 26.05 sec 394 | Success: 5 Errors: 0 Avg rate: 0.20 qps Execution time: 27.05 sec 395 | Success: 5 Errors: 0 Avg rate: 0.20 qps Execution time: 28.05 sec 396 | Success: 5 Errors: 0 Avg rate: 0.20 qps Execution time: 29.05 sec 397 | Success: 5 Errors: 0 Avg rate: 0.20 qps Execution time: 30.05 sec 398 | Success: 5 Errors: 0 Avg rate: 0.20 qps Execution time: 31.05 sec 399 | ^C 400 | Success: 5 Errors: 0 Avg rate: 0.20 qps Execution time: 31.35 sec 401 | Avg rate based on total execution time and success connections: 0.16 qps 402 | [root@dev ~]# ./zabbix-agent-stress-test.py -s 127.0.0.1 -k docker.discovery 403 | Starting 1 threads, host: 127.0.0.1:10050, key: docker.discovery 404 | Success: 5 Errors: 0 Avg rate: 6.26 qps Execution time: 1.00 sec 405 | Success: 5 Errors: 0 Avg rate: 6.26 qps Execution time: 2.00 sec 406 | Success: 12 Errors: 0 Avg rate: 7.45 qps Execution time: 3.00 sec 407 | Success: 20 Errors: 0 Avg rate: 6.77 qps Execution time: 4.00 sec 408 | Success: 28 Errors: 0 Avg rate: 7.82 qps Execution time: 5.00 sec 409 | Success: 36 Errors: 0 Avg rate: 7.21 qps Execution time: 6.01 sec 410 | Success: 43 Errors: 0 Avg rate: 10.22 qps Execution time: 7.01 sec 411 | Success: 43 Errors: 0 Avg rate: 10.22 qps Execution time: 8.01 sec 412 | Success: 50 Errors: 0 Avg rate: 6.79 qps Execution time: 9.01 sec 413 | Success: 57 Errors: 0 Avg rate: 6.11 qps Execution time: 10.01 sec 414 | Success: 66 Errors: 0 Avg rate: 8.50 qps Execution time: 11.01 sec 415 | Success: 73 Errors: 0 Avg rate: 6.51 qps Execution time: 12.01 sec 416 | Success: 81 Errors: 0 Avg rate: 7.18 qps Execution time: 13.01 sec 417 | Success: 82 Errors: 0 Avg rate: 7.85 qps Execution time: 14.01 sec 418 | Success: 87 Errors: 0 Avg rate: 6.54 qps Execution time: 15.02 sec 419 | Success: 95 Errors: 0 Avg rate: 7.84 qps Execution time: 16.02 sec 420 | Success: 103 Errors: 0 Avg rate: 9.24 qps Execution time: 17.02 sec 421 | Success: 111 Errors: 0 Avg rate: 9.94 qps Execution time: 18.02 sec 422 | Success: 119 Errors: 0 Avg rate: 7.63 qps Execution time: 19.02 sec 423 | Success: 120 Errors: 0 Avg rate: 6.70 qps Execution time: 20.12 sec 424 | Success: 121 Errors: 0 Avg rate: 3.61 qps Execution time: 21.12 sec 425 | Success: 128 Errors: 0 Avg rate: 8.46 qps Execution time: 22.12 sec 426 | Success: 136 Errors: 0 Avg rate: 7.63 qps Execution time: 23.12 sec 427 | Success: 144 Errors: 0 Avg rate: 6.21 qps Execution time: 24.12 sec 428 | Success: 150 Errors: 0 Avg rate: 6.89 qps Execution time: 25.12 sec 429 | Success: 157 Errors: 0 Avg rate: 10.87 qps Execution time: 26.18 sec 430 | Success: 160 Errors: 0 Avg rate: 7.52 qps Execution time: 27.18 sec 431 | Success: 168 Errors: 0 Avg rate: 9.81 qps Execution time: 28.18 sec 432 | Success: 174 Errors: 0 Avg rate: 6.69 qps Execution time: 29.18 sec 433 | Success: 181 Errors: 0 Avg rate: 6.35 qps Execution time: 30.18 sec 434 | Success: 188 Errors: 0 Avg rate: 7.64 qps Execution time: 31.19 sec 435 | ^C 436 | Success: 193 Errors: 0 Avg rate: 8.83 qps Execution time: 31.79 sec 437 | Avg rate based on total execution time and success connections: 6.07 qps 438 | 439 | How it works 440 | ============ 441 | 442 | See https://blog.docker.com/2013/10/gathering-lxc-docker-containers-metrics/ 443 | Metrics for containers are read from cgroup file system. 444 | [Docker API](https://docs.docker.com/reference/api/docker_remote_api) is used 445 | for discovering and some keys. However root or docker permissions are required 446 | for communication with Docker via unix socket. You can test API also in your 447 | command line: 448 | 449 | ```bash 450 | echo -e "GET /containers/json?all=0 HTTP/1.0\r\n" | nc -U /var/run/docker.sock 451 | # or if you have curl 7.40+ 452 | curl --unix-socket /var/run/docker.sock --no-buffer -XGET v1.24/containers/json?all=0 453 | ``` 454 | 455 | # Recommended docs 456 | 457 | - https://docs.docker.com/engine/admin/runmetrics/ 458 | - https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt 459 | - https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt 460 | - https://www.kernel.org/doc/Documentation/cgroup-v1/cpuacct.txt 461 | - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/index.html 462 | 463 | # Built-in Zabbix Docker monitoring 464 | 465 | Keep in mind that Zabbix itself supports Docker monitoring. It is available only for agent2 - see [Zabbix agent2 doc](https://www.zabbix.com/integrations/docker). 466 | 467 | # Contributors 468 | 469 | Thank you to all [project contributors](https://github.com/monitoringartist/zabbix-docker-monitoring/graphs/contributors). 470 | 471 | # Author 472 | 473 | [Devops Monitoring Expert](http://www.jangaraj.com 'DevOps / Docker / Kubernetes / AWS ECS / Google GCP / Zabbix / Zenoss / Terraform / Monitoring'), 474 | who loves monitoring systems and cutting/bleeding edge technologies: Docker, 475 | Kubernetes, ECS, AWS, Google GCP, Terraform, Lambda, Zabbix, Grafana, Elasticsearch, 476 | Kibana, Prometheus, Sysdig,... 477 | 478 | Summary: 479 | * 4 000+ [GitHub](https://github.com/monitoringartist/) stars 480 | * 10 000 000+ [Grafana dashboard](https://grafana.net/monitoringartist) downloads 481 | * 60 000 000+ [Docker images](https://hub.docker.com/u/monitoringartist/) downloads 482 | 483 | Professional devops / monitoring / consulting services: 484 | 485 | [![Monitoring Artist](http://monitoringartist.com/img/github-monitoring-artist-logo.jpg)](http://www.monitoringartist.com 'DevOps / Docker / Kubernetes / AWS ECS / Google GCP / Zabbix / Zenoss / Terraform / Monitoring') 486 | -------------------------------------------------------------------------------- /doc/logo_centos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/f4c80ba11ef00a02f9b3b40fbca10522d9a92e38/doc/logo_centos.png -------------------------------------------------------------------------------- /doc/logo_debian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/f4c80ba11ef00a02f9b3b40fbca10522d9a92e38/doc/logo_debian.png -------------------------------------------------------------------------------- /doc/logo_docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/f4c80ba11ef00a02f9b3b40fbca10522d9a92e38/doc/logo_docker.png -------------------------------------------------------------------------------- /doc/logo_redhat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/f4c80ba11ef00a02f9b3b40fbca10522d9a92e38/doc/logo_redhat.png -------------------------------------------------------------------------------- /doc/logo_ubuntu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/f4c80ba11ef00a02f9b3b40fbca10522d9a92e38/doc/logo_ubuntu.png -------------------------------------------------------------------------------- /doc/zabbix-docker-container-cpu-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/f4c80ba11ef00a02f9b3b40fbca10522d9a92e38/doc/zabbix-docker-container-cpu-graph.png -------------------------------------------------------------------------------- /doc/zabbix-docker-container-memory-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/f4c80ba11ef00a02f9b3b40fbca10522d9a92e38/doc/zabbix-docker-container-memory-graph.png -------------------------------------------------------------------------------- /doc/zabbix-docker-container-state-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/f4c80ba11ef00a02f9b3b40fbca10522d9a92e38/doc/zabbix-docker-container-state-graph.png -------------------------------------------------------------------------------- /dockerfiles/amazonlinux/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/monitoringartist/zabbix-docker-monitoring 2 | 3 | # Define required Amazon Linux version by using FROM amazonlinux:2 4 | FROM amazonlinux:2 5 | 6 | MAINTAINER "Jan Garaj" 7 | 8 | WORKDIR /root 9 | 10 | RUN \ 11 | yum -y -q install git automake autoconf gcc make pcre-devel jansson-devel 1>/dev/null 12 | 13 | RUN \ 14 | git clone -q https://github.com/monitoringartist/zabbix-docker-monitoring 15 | 16 | # Define required Zabbix version () or release (release/), e.g. 4.2.2, or release/4.2 17 | ARG ZABBIX_VERSION=release/5.2 18 | 19 | RUN \ 20 | git clone -b ${ZABBIX_VERSION} --depth 1 https://github.com/zabbix/zabbix.git ~/zabbix && \ 21 | cd ~/zabbix/ && \ 22 | ./bootstrap.sh 1>/dev/null && \ 23 | ./configure --enable-agent 1>/dev/null && \ 24 | cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ && \ 25 | cd ~/zabbix/src/modules/zabbix_module_docker && \ 26 | make 27 | 28 | ## Dockerized compilation (build from remote URL or local PATH): 29 | # docker build --rm=true -t local/zabbix-docker-module-compilation https://github.com/monitoringartist/zabbix-docker-monitoring.git#master:dockerfiles/centos/ 30 | # docker build --rm=true -t local/zabbix-docker-module-compilation . 31 | # docker run --rm -v /tmp:/tmp local/zabbix-docker-module-compilation cp /root/zabbix/src/modules/zabbix_module_docker/zabbix_module_docker.so /tmp/zabbix_module_docker.so 32 | # docker rmi -f local/zabbix-docker-module-compilation 33 | ## use/copy /tmp/zabbix_module_docker.so in your Zabbix 34 | -------------------------------------------------------------------------------- /dockerfiles/centos/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/monitoringartist/zabbix-docker-monitoring 2 | 3 | # Define required CentOS version by using FROM centos:8 4 | FROM centos:8 5 | 6 | MAINTAINER "Jan Garaj" 7 | 8 | 9 | WORKDIR /root 10 | 11 | RUN \ 12 | yum -y -q install git automake autoconf gcc make pcre-devel jansson-devel 1>/dev/null 13 | 14 | RUN \ 15 | git clone -q https://github.com/monitoringartist/zabbix-docker-monitoring 16 | 17 | # Define required Zabbix version () or release (release/), e.g. 4.2.2, or release/4.2 18 | ARG ZABBIX_VERSION=release/5.2 19 | 20 | RUN \ 21 | git clone -b ${ZABBIX_VERSION} --depth 1 https://github.com/zabbix/zabbix.git ~/zabbix && \ 22 | cd ~/zabbix/ && \ 23 | ./bootstrap.sh 1>/dev/null && \ 24 | ./configure --enable-agent 1>/dev/null && \ 25 | cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ && \ 26 | cd ~/zabbix/src/modules/zabbix_module_docker && \ 27 | make 28 | 29 | ## Dockerized compilation (build from remote URL or local PATH): 30 | # docker build --rm=true -t local/zabbix-docker-module-compilation https://github.com/monitoringartist/zabbix-docker-monitoring.git#master:dockerfiles/centos/ 31 | # docker build --rm=true -t local/zabbix-docker-module-compilation . 32 | # docker run --rm -v /tmp:/tmp local/zabbix-docker-module-compilation cp /root/zabbix/src/modules/zabbix_module_docker/zabbix_module_docker.so /tmp/zabbix_module_docker.so 33 | # docker rmi -f local/zabbix-docker-module-compilation 34 | ## use/copy /tmp/zabbix_module_docker.so in your Zabbix 35 | -------------------------------------------------------------------------------- /dockerfiles/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/monitoringartist/zabbix-docker-monitoring 2 | 3 | # Define required Debian version by using FROM tag. Avalaible: wheezy/jessie/buster/... 4 | FROM debian:latest 5 | 6 | MAINTAINER "Jan Garaj" 7 | 8 | WORKDIR /root 9 | 10 | RUN \ 11 | apt-get -qq update 1>/dev/null && \ 12 | apt-get -qq --assume-yes install git automake autoconf gcc make pkg-config libpcre3-dev libjansson-dev 1>/dev/null 13 | 14 | RUN \ 15 | git clone -q https://github.com/monitoringartist/zabbix-docker-monitoring 16 | 17 | # Define required Zabbix version () or release (branches/), e.g. 4.2.2, or release/4.2 18 | ARG ZABBIX_VERSION=release/5.2 19 | 20 | RUN \ 21 | git clone -b ${ZABBIX_VERSION} --depth 1 https://github.com/zabbix/zabbix.git ~/zabbix && \ 22 | cd ~/zabbix/ && \ 23 | ./bootstrap.sh 1>/dev/null && \ 24 | ./configure --enable-agent 1>/dev/null && \ 25 | cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ && \ 26 | cd ~/zabbix/src/modules/zabbix_module_docker && \ 27 | make 28 | 29 | ## Dockerized compilation (build from remote URL or local PATH): 30 | # docker build --rm=true -t local/zabbix-docker-module-compilation https://github.com/monitoringartist/zabbix-docker-monitoring.git#master:dockerfiles/debian/ 31 | # docker build --rm=true -t local/zabbix-docker-module-compilation . 32 | # docker run --rm -v /tmp:/tmp local/zabbix-docker-module-compilation cp /root/zabbix/src/modules/zabbix_module_docker/zabbix_module_docker.so /tmp/zabbix_module_docker.so 33 | # docker rmi -f local/zabbix-docker-module-compilation 34 | ## use/copy /tmp/zabbix_module_docker.so in your Zabbix 35 | -------------------------------------------------------------------------------- /dockerfiles/fedora/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/monitoringartist/zabbix-docker-monitoring 2 | 3 | # Define required CentOS version by using FROM tag. Avalaible: centos7/centos6/... 4 | FROM fedora:latest 5 | 6 | MAINTAINER "Jan Garaj" 7 | 8 | WORKDIR /root 9 | 10 | RUN \ 11 | dnf -y -q install git automake autoconf gcc make pcre-devel jansson-devel 1>/dev/null 12 | 13 | RUN \ 14 | git clone -q https://github.com/monitoringartist/zabbix-docker-monitoring 15 | 16 | # Define required Zabbix version () or release (release/), e.g. 4.2.2, or release/4.2 17 | ARG ZABBIX_VERSION=release/5.2 18 | 19 | RUN \ 20 | git clone -b ${ZABBIX_VERSION} --depth 1 https://github.com/zabbix/zabbix.git ~/zabbix && \ 21 | cd ~/zabbix/ && \ 22 | ./bootstrap.sh 1>/dev/null && \ 23 | ./configure --enable-agent 1>/dev/null && \ 24 | cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ && \ 25 | cd ~/zabbix/src/modules/zabbix_module_docker && \ 26 | make 27 | 28 | ## Dockerized compilation (build from remote URL or local PATH): 29 | # docker build --rm=true -t local/zabbix-docker-module-compilation https://github.com/monitoringartist/zabbix-docker-monitoring.git#master:dockerfiles/centos/ 30 | # docker build --rm=true -t local/zabbix-docker-module-compilation . 31 | # docker run --rm -v /tmp:/tmp local/zabbix-docker-module-compilation cp /root/zabbix/src/modules/zabbix_module_docker/zabbix_module_docker.so /tmp/zabbix_module_docker.so 32 | # docker rmi -f local/zabbix-docker-module-compilation 33 | ## use/copy /tmp/zabbix_module_docker.so in your Zabbix 34 | -------------------------------------------------------------------------------- /dockerfiles/opensuse/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/monitoringartist/zabbix-docker-monitoring 2 | 3 | # Define required openSuse version by using FROM tag. Avalaible: wheezy/jessie/... 4 | FROM opensuse/leap:latest 5 | 6 | MAINTAINER "Jan Garaj" 7 | 8 | WORKDIR /root 9 | 10 | RUN \ 11 | zypper install --no-confirm --no-recommends git automake autoconf gcc make pkg-config pcre-devel libjansson-devel 1>/dev/null 12 | 13 | RUN \ 14 | git clone -q https://github.com/monitoringartist/zabbix-docker-monitoring 15 | 16 | # Define required Zabbix version () or release (release/), e.g. 4.2.2, or release/4.2 17 | ARG ZABBIX_VERSION=release/5.2 18 | 19 | RUN \ 20 | git clone -b ${ZABBIX_VERSION} --depth 1 https://github.com/zabbix/zabbix.git ~/zabbix && \ 21 | cd ~/zabbix/ && \ 22 | ./bootstrap.sh 1>/dev/null && \ 23 | ./configure --enable-agent 1>/dev/null && \ 24 | cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ && \ 25 | cd ~/zabbix/src/modules/zabbix_module_docker && \ 26 | make 27 | 28 | ## Dockerized compilation (build from remote URL or local PATH): 29 | # docker build --rm=true -t local/zabbix-docker-module-compilation https://github.com/monitoringartist/zabbix-docker-monitoring.git#master:dockerfiles/debian/ 30 | # docker build --rm=true -t local/zabbix-docker-module-compilation . 31 | # docker run --rm -v /tmp:/tmp local/zabbix-docker-module-compilation cp /root/zabbix/src/modules/zabbix_module_docker/zabbix_module_docker.so /tmp/zabbix_module_docker.so 32 | # docker rmi -f local/zabbix-docker-module-compilation 33 | ## use/copy /tmp/zabbix_module_docker.so in your Zabbix 34 | -------------------------------------------------------------------------------- /dockerfiles/ubuntu/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/monitoringartist/zabbix-docker-monitoring 2 | 3 | # Define required Ubuntu version by using FROM tag. Avalaible: wheezy/jessie/... 4 | FROM ubuntu:latest 5 | 6 | MAINTAINER "Jan Garaj" 7 | 8 | WORKDIR /root 9 | 10 | RUN \ 11 | apt-get -qq update 1>/dev/null && \ 12 | ln -snf /usr/share/zoneinfo/UTC /etc/localtime && \ 13 | apt-get -qq --assume-yes install git automake autoconf gcc make pkg-config libpcre3-dev libjansson-dev 1>/dev/null 14 | 15 | RUN \ 16 | git clone -q https://github.com/monitoringartist/zabbix-docker-monitoring 17 | 18 | # Define required Zabbix version () or release (release/), e.g. 4.2.2, or release/4.2 19 | ARG ZABBIX_VERSION=release/5.2 20 | 21 | RUN \ 22 | git clone -b ${ZABBIX_VERSION} --depth 1 https://github.com/zabbix/zabbix.git ~/zabbix && \ 23 | cd ~/zabbix/ && \ 24 | ./bootstrap.sh 1>/dev/null && \ 25 | ./configure --enable-agent 1>/dev/null && \ 26 | cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ && \ 27 | cd ~/zabbix/src/modules/zabbix_module_docker && \ 28 | make 29 | 30 | ## Dockerized compilation (build from remote URL or local PATH): 31 | # docker build --rm=true -t local/zabbix-docker-module-compilation https://github.com/monitoringartist/zabbix-docker-monitoring.git#master:dockerfiles/ubuntu/ 32 | # docker build --rm=true -t local/zabbix-docker-module-compilation . 33 | # docker run --rm -v /tmp:/tmp local/zabbix-docker-module-compilation cp /root/zabbix/src/modules/zabbix_module_docker/zabbix_module_docker.so /tmp/zabbix_module_docker.so 34 | # docker rmi -f local/zabbix-docker-module-compilation 35 | ## use/copy /tmp/zabbix_module_docker.so in your Zabbix 36 | -------------------------------------------------------------------------------- /selinux/zabbix-docker.te: -------------------------------------------------------------------------------- 1 | module zabbix-docker 1.1; 2 | 3 | require { 4 | type docker_var_run_t; 5 | type unreserved_port_t; 6 | type zabbix_agent_t; 7 | type docker_t; 8 | type cgroup_t; 9 | type modules_object_t; 10 | class sock_file write; 11 | class unix_stream_socket connectto; 12 | class capability dac_override; 13 | class tcp_socket name_connect; 14 | class file { ioctl read getattr lock open execute }; 15 | class dir { ioctl read getattr lock add_name reparent search open }; 16 | } 17 | 18 | #============= zabbix_agent_t ============== 19 | 20 | allow zabbix_agent_t docker_t:unix_stream_socket connectto; 21 | allow zabbix_agent_t docker_var_run_t:sock_file write; 22 | allow zabbix_agent_t self:capability dac_override; 23 | allow zabbix_agent_t unreserved_port_t:tcp_socket name_connect; 24 | allow zabbix_agent_t cgroup_t:file { ioctl read getattr lock open }; 25 | allow zabbix_agent_t cgroup_t:dir { ioctl read getattr lock search open }; 26 | allow zabbix_agent_t modules_object_t:file { read open execute }; 27 | -------------------------------------------------------------------------------- /src/modules/zabbix_module_docker/Makefile: -------------------------------------------------------------------------------- 1 | ZABBIX_SOURCE = ../../.. 2 | 3 | zabbix_module_docker: zabbix_module_docker.c 4 | gcc -fPIC -shared -o zabbix_module_docker.so zabbix_module_docker.c -I$(ZABBIX_SOURCE)/include `pkg-config --cflags --libs jansson` 5 | -------------------------------------------------------------------------------- /template/UNTESTED-Zabbix-Template-App-Docker-as-host(3.x-only).xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3.0 4 | 2016-05-28T08:12:49Z 5 | 6 | 7 | Agent Docker 8 | 9 | 10 | Docker Containers 11 | 12 | 13 | Templates 14 | 15 | 16 | 17 | 317 | 600 | 601 | 602 | 603 | Container Info 604 | 900 605 | 200 606 | 0.0000 607 | 0.0000 608 | 0 609 | 0 610 | 2 611 | 1 612 | 1 613 | 0.0000 614 | 0.0000 615 | 0 616 | 0 617 | 0 618 | 0 619 | 620 | 621 | 0 622 | 0 623 | 1A7C11 624 | 0 625 | 9 626 | 0 627 | 628 | UNTESTED Template App Docker as host - www.monitoringartist.com 629 | docker.cstatus[Crashed] 630 | 631 | 632 | 633 | 1 634 | 0 635 | F63100 636 | 0 637 | 9 638 | 0 639 | 640 | UNTESTED Template App Docker as host - www.monitoringartist.com 641 | docker.cstatus[Exited] 642 | 643 | 644 | 645 | 2 646 | 0 647 | 2774A4 648 | 0 649 | 9 650 | 0 651 | 652 | UNTESTED Template App Docker as host - www.monitoringartist.com 653 | docker.cstatus[Paused] 654 | 655 | 656 | 657 | 3 658 | 0 659 | A54F10 660 | 0 661 | 9 662 | 0 663 | 664 | UNTESTED Template App Docker as host - www.monitoringartist.com 665 | docker.cstatus[Up] 666 | 667 | 668 | 669 | 670 | 671 | CPU utilization of {#HCONTAINERID} container 672 | 900 673 | 200 674 | 0.0000 675 | 100.0000 676 | 1 677 | 1 678 | 1 679 | 1 680 | 0 681 | 0.0000 682 | 0.0000 683 | 1 684 | 0 685 | 0 686 | 0 687 | 688 | 689 | 0 690 | 0 691 | 990000 692 | 0 693 | 2 694 | 0 695 | 696 | Template App Docker as host container - www.monitoringartist.com 697 | docker.cpu[/{#HCONTAINERID},system] 698 | 699 | 700 | 701 | 1 702 | 0 703 | 000099 704 | 0 705 | 2 706 | 0 707 | 708 | Template App Docker as host container - www.monitoringartist.com 709 | docker.cpu[/{#HCONTAINERID},user] 710 | 711 | 712 | 713 | 714 | 715 | Memory usage of {#HCONTAINERID} container 716 | 900 717 | 200 718 | 0.0000 719 | 100.0000 720 | 1 721 | 1 722 | 1 723 | 1 724 | 0 725 | 0.0000 726 | 0.0000 727 | 1 728 | 0 729 | 0 730 | 0 731 | 732 | 733 | 0 734 | 0 735 | 00C800 736 | 0 737 | 2 738 | 0 739 | 740 | Template App Docker as host container - www.monitoringartist.com 741 | docker.mem[/{#HCONTAINERID},total_cache] 742 | 743 | 744 | 745 | 1 746 | 0 747 | 0000C8 748 | 0 749 | 2 750 | 0 751 | 752 | Template App Docker as host container - www.monitoringartist.com 753 | docker.mem[/{#HCONTAINERID},total_rss] 754 | 755 | 756 | 757 | 2 758 | 0 759 | EE0000 760 | 0 761 | 2 762 | 0 763 | 764 | Template App Docker as host container - www.monitoringartist.com 765 | docker.mem[/{#HCONTAINERID},total_swap] 766 | 767 | 768 | 769 | 770 | 771 | State of {#HCONTAINERID} container 772 | 900 773 | 200 774 | 0.0000 775 | 100.0000 776 | 1 777 | 1 778 | 0 779 | 1 780 | 0 781 | 0.0000 782 | 0.0000 783 | 1 784 | 0 785 | 0 786 | 0 787 | 788 | 789 | 0 790 | 0 791 | 000088 792 | 0 793 | 2 794 | 0 795 | 796 | Template App Docker as host container - www.monitoringartist.com 797 | docker.up[/{#HCONTAINERID}] 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | Service state 806 | 807 | 808 | 0 809 | Down 810 | 811 | 812 | 1 813 | Up 814 | 815 | 816 | 817 | 818 | 819 | -------------------------------------------------------------------------------- /template/Zabbix-Template-App-Docker-Mesos-Marathon-Chronos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2016-05-28T14:20:02Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 410 | 411 | 412 | -------------------------------------------------------------------------------- /template/Zabbix-Template-App-Docker-active.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2015-07-22T01:34:34Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 405 | 406 | 407 | -------------------------------------------------------------------------------- /template/Zabbix-Template-App-Docker.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2017-03-19T11:16:46Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 410 | 411 | 412 | --------------------------------------------------------------------------------