Skip to content

Commit

Permalink
Add
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Schöchlin <ms@256bit.org>
  • Loading branch information
scoopex committed Dec 25, 2024
1 parent e93eca9 commit 2e45904
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# see https://github.com/zabbix/zabbix-docker/blob/7.2/Dockerfiles/agent/ubuntu/Dockerfile
FROM zabbix/zabbix-agent:ubuntu-7.2-latest

USER 0
Expand All @@ -9,7 +10,7 @@ ADD zabbix-agent-extensions_*_all.deb /tmp/setup
RUN /tmp/setup/04_install_agent_extensions.sh
RUN /tmp/setup/05_perform_upgrade.sh

ENTRYPOINT ["/usr/bin/tini", "--", "/usr/bin/docker-entrypoint.sh"]
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]

USER 1997

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ Install the agent extensions on kubernetes nodes
---------------------------------------------

This procedure deploy zabbix agents on all worker nodes of your kubernetes cluster and provides autodiscovery for all nodes
It is based on the offical [image](https://hub.docker.com/r/zabbix/zabbix-agent).


* Make zabbix available to the deployed agent, i.e. by deploying a zabbix proxy in k8s
* Import template [custom-os-kubernetes-node.xml](http://htmlpreview.github.io/?https://github.com/scoopex/zabbix-agent-extensions/blob/master/zabbix_templates/5.2/documentation/custom-os-kubernetes-node.html)
Expand All @@ -129,7 +131,7 @@ This procedure deploy zabbix agents on all worker nodes of your kubernetes clust
* "Link to templates: Custom - OS - Kubernetes Node"
* Configure deployment
* Download [kubernetes yaml file](https://raw.githubusercontent.com/scoopex/zabbix-agent-extensions/master/zabbix-agent-daemonset-kubernetes.yaml)
* Adapt the file to your own needs
* Adapt the file to your own needs, see [environment variables](https://hub.docker.com/r/zabbix/zabbix-agent)
* Configure `ZBX_ACTIVESERVER`
* Configure `ZBX_PASSIVESERVERS`
* Configure the version of the image [check dockerhub](https://hub.docker.com/repository/docker/scoopex666/zabbix-agent-with-agent-extensions)
Expand All @@ -143,14 +145,15 @@ This procedure deploy zabbix agents on all worker nodes of your kubernetes clust
Test docker image
---------------------------------------------
It is based on the offical [image](https://hub.docker.com/r/zabbix/zabbix-agent).
```
docker run scoopex666/zabbix-agent-with-agent-extensions
docker run -d --rm \
-e ZBX_ACTIVESERVER=127.0.0.1 \
-e ZBX_PASSIVESERVERS=127.0.0.1 \
--name zabbix-agent-extentions-test \
scoopex666/zabbix-agent-with-agent-extensions
docker exec -ti zabbix-agent-extentions-test zabbix_get -s 127.0.0.1 -k zabbix.agent_extensions.version
docker exec -u root -ti zabbix-agent-extentions-test zabbix_get -s 127.0.0.1 -k zabbix.agent_extensions.version
docker stop zabbix-agent-extentions-test
```
Expand Down
19 changes: 16 additions & 3 deletions create_docker
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,31 @@ IMAGE_NAME="zabbix-agent-with-agent-extensions"
VERSION="${2:-$(git describe --abbrev=0 --tags)}"

if [ "$1" = "build" ];then
set -x
docker rmi ${IMAGE_NAME}:${VERSION}
docker build -t ${IMAGE_NAME}:${VERSION} -f Dockerfile .
elif [ "$1" = "inspect" ];then
docker run -ti ${IMAGE_NAME}:${VERSION} /bin/bash
set -x
exec docker run --rm --name zabbix-agent-extentions-test -ti ${IMAGE_NAME}:${VERSION} /bin/bash
elif [ "$1" = "publish" ];then
docker tag ${IMAGE_NAME}:${VERSION} ${IMAGE_REPO}/${IMAGE_NAME}:${VERSION}
docker push ${IMAGE_REPO}/${IMAGE_NAME}:${VERSION}
docker tag ${IMAGE_NAME}:${VERSION} ${IMAGE_REPO}/${IMAGE_NAME}:latest
docker push ${IMAGE_REPO}/${IMAGE_NAME}:latest
elif [ "$1" = "test" ];then
docker run ${IMAGE_NAME}:${VERSION}
echo "TESTING:"
echo "---"
echo "docker exec -u root -ti zabbix-agent-extentions-test zabbix_get -s 127.0.0.1 -k zabbix.agent_extensions.version"
echo "---"
set -x
exec docker run --rm \
--network host \
-e ZBX_HOSTNAME=zabbix-agent-extentions-test \
-e ZBX_SERVER_HOST=127.0.0.1 \
-e ZBX_PASSIVESERVERS=127.0.0.1 \
--name zabbix-agent-extentions-test ${IMAGE_NAME}:${VERSION}
else
echo "$0 build|inspect|publish|run"
echo "$0 build|inspect|publish|test"
fi


2 changes: 1 addition & 1 deletion docker-scripts/04_install_agent_extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ cd /tmp/setup
ls -l /tmp/setup
dpkg -i *.deb
sed -i '~s,/var/lib/zabbix/:/sbin/nologin,/var/lib/zabbix/:/bin/bash,' /etc/passwd
#cat /etc/passwd
echo "Include=/usr/share/zabbix-agent-extensions/include.d/*.conf" > /etc/zabbix/zabbix_agentd.d/zabbix-agent-extensions.conf

0 comments on commit 2e45904

Please sign in to comment.