diff --git a/Dockerfiles/agent2/alpine/Dockerfile b/Dockerfiles/agent2/alpine/Dockerfile index 602e4f73b..5e1d8e375 100644 --- a/Dockerfiles/agent2/alpine/Dockerfile +++ b/Dockerfiles/agent2/alpine/Dockerfile @@ -31,6 +31,10 @@ COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/u COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.d/plugins.d", "/etc/zabbix/zabbix_agent2.d/plugins.d"] +COPY --from=builder ["/tmp/mongodb_plugin/mongodb.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf"] +COPY --from=builder ["/tmp/postgresql_plugin/postgresql.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf"] +COPY --from=builder ["/tmp/mongodb_plugin/zabbix-agent2-plugin-mongodb", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb"] +COPY --from=builder ["/tmp/postgresql_plugin/zabbix-agent2-plugin-postgresql", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql"] RUN set -eux && \ INSTALL_PKGS="tini \ @@ -65,9 +69,9 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/enc && \ mkdir -p /var/lib/zabbix/modules && \ mkdir -p /var/lib/zabbix/buffer && \ - chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ - chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ - chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ rm -rf /var/cache/apk/* EXPOSE 10050/TCP 31999/TCP diff --git a/Dockerfiles/agent2/alpine/docker-entrypoint.sh b/Dockerfiles/agent2/alpine/docker-entrypoint.sh index b911c8806..e2dcbc6b1 100755 --- a/Dockerfiles/agent2/alpine/docker-entrypoint.sh +++ b/Dockerfiles/agent2/alpine/docker-entrypoint.sh @@ -198,9 +198,17 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +prepare_zbx_agent_plugin_config() { + echo "** Preparing Zabbix agent plugin configuration files" + + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf" "Plugins.MongoDB.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb" + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf" "Plugins.PostgreSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql" +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + prepare_zbx_agent_plugin_config } ################################################# diff --git a/Dockerfiles/agent2/centos/Dockerfile b/Dockerfiles/agent2/centos/Dockerfile index 8bb8045da..2c11c6a72 100644 --- a/Dockerfiles/agent2/centos/Dockerfile +++ b/Dockerfiles/agent2/centos/Dockerfile @@ -31,6 +31,10 @@ COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/u COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.d/plugins.d", "/etc/zabbix/zabbix_agent2.d/plugins.d"] +COPY --from=builder ["/tmp/mongodb_plugin/mongodb.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf"] +COPY --from=builder ["/tmp/postgresql_plugin/postgresql.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf"] +COPY --from=builder ["/tmp/mongodb_plugin/zabbix-agent2-plugin-mongodb", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb"] +COPY --from=builder ["/tmp/postgresql_plugin/zabbix-agent2-plugin-postgresql", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql"] RUN set -eux && \ REPOLIST="baseos,appstream,epel" && \ @@ -70,9 +74,9 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/enc && \ mkdir -p /var/lib/zabbix/modules && \ mkdir -p /var/lib/zabbix/buffer && \ - chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ - chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ - chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ dnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/agent2/centos/docker-entrypoint.sh b/Dockerfiles/agent2/centos/docker-entrypoint.sh index b911c8806..e2dcbc6b1 100755 --- a/Dockerfiles/agent2/centos/docker-entrypoint.sh +++ b/Dockerfiles/agent2/centos/docker-entrypoint.sh @@ -198,9 +198,17 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +prepare_zbx_agent_plugin_config() { + echo "** Preparing Zabbix agent plugin configuration files" + + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf" "Plugins.MongoDB.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb" + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf" "Plugins.PostgreSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql" +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + prepare_zbx_agent_plugin_config } ################################################# diff --git a/Dockerfiles/agent2/ol/Dockerfile b/Dockerfiles/agent2/ol/Dockerfile index a6865a7c1..57136e3e6 100644 --- a/Dockerfiles/agent2/ol/Dockerfile +++ b/Dockerfiles/agent2/ol/Dockerfile @@ -31,6 +31,10 @@ COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/u COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.d/plugins.d", "/etc/zabbix/zabbix_agent2.d/plugins.d"] +COPY --from=builder ["/tmp/mongodb_plugin/mongodb.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf"] +COPY --from=builder ["/tmp/postgresql_plugin/postgresql.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf"] +COPY --from=builder ["/tmp/mongodb_plugin/zabbix-agent2-plugin-mongodb", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb"] +COPY --from=builder ["/tmp/postgresql_plugin/zabbix-agent2-plugin-postgresql", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -71,9 +75,9 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/enc && \ mkdir -p /var/lib/zabbix/modules && \ mkdir -p /var/lib/zabbix/buffer && \ - chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ - chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ - chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/agent2/ol/docker-entrypoint.sh b/Dockerfiles/agent2/ol/docker-entrypoint.sh index b911c8806..e2dcbc6b1 100755 --- a/Dockerfiles/agent2/ol/docker-entrypoint.sh +++ b/Dockerfiles/agent2/ol/docker-entrypoint.sh @@ -198,9 +198,17 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +prepare_zbx_agent_plugin_config() { + echo "** Preparing Zabbix agent plugin configuration files" + + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf" "Plugins.MongoDB.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb" + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf" "Plugins.PostgreSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql" +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + prepare_zbx_agent_plugin_config } ################################################# diff --git a/Dockerfiles/agent2/rhel/Dockerfile b/Dockerfiles/agent2/rhel/Dockerfile index e1faba58c..2bcdc944c 100644 --- a/Dockerfiles/agent2/rhel/Dockerfile +++ b/Dockerfiles/agent2/rhel/Dockerfile @@ -50,6 +50,10 @@ COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/u COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.d/plugins.d", "/etc/zabbix/zabbix_agent2.d/plugins.d"] +COPY --from=builder ["/tmp/mongodb_plugin/mongodb.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf"] +COPY --from=builder ["/tmp/postgresql_plugin/postgresql.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf"] +COPY --from=builder ["/tmp/mongodb_plugin/zabbix-agent2-plugin-mongodb", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb"] +COPY --from=builder ["/tmp/postgresql_plugin/zabbix-agent2-plugin-postgresql", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql"] RUN set -eux && \ INSTALL_PKGS="bash \ @@ -97,9 +101,9 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/enc && \ mkdir -p /var/lib/zabbix/modules && \ mkdir -p /var/lib/zabbix/buffer && \ - chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ - chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ - chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ microdnf -y clean all && \ rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \ rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki diff --git a/Dockerfiles/agent2/rhel/docker-entrypoint.sh b/Dockerfiles/agent2/rhel/docker-entrypoint.sh index b911c8806..e2dcbc6b1 100755 --- a/Dockerfiles/agent2/rhel/docker-entrypoint.sh +++ b/Dockerfiles/agent2/rhel/docker-entrypoint.sh @@ -198,9 +198,17 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +prepare_zbx_agent_plugin_config() { + echo "** Preparing Zabbix agent plugin configuration files" + + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf" "Plugins.MongoDB.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb" + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf" "Plugins.PostgreSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql" +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + prepare_zbx_agent_plugin_config } ################################################# diff --git a/Dockerfiles/agent2/ubuntu/Dockerfile b/Dockerfiles/agent2/ubuntu/Dockerfile index 105503225..93ef55d1d 100644 --- a/Dockerfiles/agent2/ubuntu/Dockerfile +++ b/Dockerfiles/agent2/ubuntu/Dockerfile @@ -31,6 +31,10 @@ COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/u COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.d/plugins.d", "/etc/zabbix/zabbix_agent2.d/plugins.d"] +COPY --from=builder ["/tmp/mongodb_plugin/mongodb.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf"] +COPY --from=builder ["/tmp/postgresql_plugin/postgresql.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf"] +COPY --from=builder ["/tmp/mongodb_plugin/zabbix-agent2-plugin-mongodb", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb"] +COPY --from=builder ["/tmp/postgresql_plugin/zabbix-agent2-plugin-postgresql", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql"] RUN set -eux && \ echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \ @@ -66,9 +70,9 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/enc && \ mkdir -p /var/lib/zabbix/modules && \ mkdir -p /var/lib/zabbix/buffer && \ - chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ - chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ - chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ + chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \ apt-get -y autoremove && \ apt-get -y clean && \ rm -rf /var/lib/apt/lists/* diff --git a/Dockerfiles/agent2/ubuntu/docker-entrypoint.sh b/Dockerfiles/agent2/ubuntu/docker-entrypoint.sh index b911c8806..e2dcbc6b1 100755 --- a/Dockerfiles/agent2/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/agent2/ubuntu/docker-entrypoint.sh @@ -198,9 +198,17 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +prepare_zbx_agent_plugin_config() { + echo "** Preparing Zabbix agent plugin configuration files" + + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf" "Plugins.MongoDB.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb" + update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf" "Plugins.PostgreSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql" +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + prepare_zbx_agent_plugin_config } ################################################# diff --git a/Dockerfiles/build-mysql/alpine/Dockerfile b/Dockerfiles/build-mysql/alpine/Dockerfile index 2fe2ee25b..4eed34e36 100644 --- a/Dockerfiles/build-mysql/alpine/Dockerfile +++ b/Dockerfiles/build-mysql/alpine/Dockerfile @@ -19,6 +19,9 @@ LABEL org.opencontainers.image.authors="Alexey Pustovalov