From e43e07af1bc86d25da4eb2928a241781168e25ba Mon Sep 17 00:00:00 2001 From: Maciej Lebiest Date: Sun, 20 Aug 2023 16:20:57 +0200 Subject: [PATCH] add zabbix-agent, rename toolbox --- README.md | 30 ++++++++++++++++++++- {toolbox => system-toolbox}/Dockerfile | 0 {toolbox => system-toolbox}/help-toolbox.sh | 0 zabbix-agent/Dockerfile | 8 ++++++ 4 files changed, 37 insertions(+), 1 deletion(-) rename {toolbox => system-toolbox}/Dockerfile (100%) rename {toolbox => system-toolbox}/help-toolbox.sh (100%) create mode 100644 zabbix-agent/Dockerfile diff --git a/README.md b/README.md index 464b530..784f399 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Containers-Workspace Various useful and useless Dockerfiles, often experimental and work in progress -## toolbox +## system-toolbox Fedora based container wih preinstalled many usefull tools for various debug and problem searching purposes run help-toolbox to show what can you do in there @@ -143,3 +143,31 @@ podman run --privileged --name wireguard -d \ -v './setup:/setup.d:ro' \ -wireguard:latest ``` + +## zabbix-agent + +Very simple alpine-based zabbix-agent image providing additioanl deps +required for SMART monitoring. + +Setting up such contenerized agent in systemd based system: + +```bash +systemctl stop zabbix-agent.service; +podman rm -f zabbix-agent; +rm -f /etc/systemd/system/zabbix-agent.service; + +podman run --restart no \ + --network host --pid host --ipc host --no-hosts --ulimit host --userns host \ + --privileged \ + -v "/path/to/custom/config.conf:/etc/zabbix/zabbix_agent2.conf:ro" \ + -v "/sys:/sys:ro" \ + -v "/sys/fs/cgroup:/sys/fs/cgroup:ro" \ + -v "/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:rw" \ + --name zabbix-agent \ + -d localhost/zabbix-agent; + +podman generate systemd --new --name zabbix-agent > /etc/systemd/system/zabbix-agent.service; +restorecon -v /etc/systemd/system/zabbix-agent.service; +systemctl daemon-reload; +systemctl enable --now zabbix-agent.service; +``` diff --git a/toolbox/Dockerfile b/system-toolbox/Dockerfile similarity index 100% rename from toolbox/Dockerfile rename to system-toolbox/Dockerfile diff --git a/toolbox/help-toolbox.sh b/system-toolbox/help-toolbox.sh similarity index 100% rename from toolbox/help-toolbox.sh rename to system-toolbox/help-toolbox.sh diff --git a/zabbix-agent/Dockerfile b/zabbix-agent/Dockerfile new file mode 100644 index 0000000..9ece151 --- /dev/null +++ b/zabbix-agent/Dockerfile @@ -0,0 +1,8 @@ +FROM docker.io/alpine:latest + +RUN apk add smartmontools util-linux zabbix-agent2 zabbix-utils sudo && \ + echo 'zabbix ALL=(ALL) NOPASSWD:/usr/sbin/smartctl' >> /etc/sudoers + +USER zabbix + +ENTRYPOINT [ "/usr/sbin/zabbix_agent2", "-f" ]