Skip to content

Instantly share code, notes, and snippets.

@FilBot3
Last active December 16, 2023 19:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FilBot3/8c5dec95c83399d021f4c622ff51d07a to your computer and use it in GitHub Desktop.
Save FilBot3/8c5dec95c83399d021f4c622ff51d07a to your computer and use it in GitHub Desktop.
Run Zabbix in Podman Pods. I had to update the images a bit, and used full option flags.
#!/usr/bin/env bash
#
# @see https://www.zabbix.com/documentation/current/en/manual/installation/containers
CONTAINER_TAG="6.2.0-alpine"
function help_menu() {
cat << EOF
usage: zabbix-in-podman-pod.sh COMMAND
COMMAND can be:
up - Start the Zabbix Services in Podman Pod
down - Stop and Remove the Podman Pod.
EOF
}
function up() {
podman pod create --name zabbix --publish 8081:8080 --publish 10051:10051
podman run --name zabbix-agent \
--env ZBX_SERVER_HOST="127.0.0.1,localhost" \
--restart=always \
--pod=zabbix \
--detach \
docker.io/zabbix/zabbix-agent:${CONTAINER_TAG}
#registry.connect.redhat.com/zabbix/zabbix-agent-50:latest
podman run --name mysql-server \
--tty \
--env MYSQL_DATABASE="zabbix" \
--env MYSQL_USER="zabbix" \
--env MYSQL_PASSWORD="zabbix_pwd" \
--env MYSQL_ROOT_PASSWORD="root_pwd" \
--volume ./mysql/:/var/lib/mysql/:Z \
--restart=always \
--pod=zabbix \
--detach \
docker.io/library/mysql:8.0 \
--character-set-server=utf8 \
--collation-server=utf8_bin \
--default-authentication-plugin=mysql_native_password
podman run --name zabbix-server-mysql \
--tty \
--env DB_SERVER_HOST="127.0.0.1" \
--env MYSQL_DATABASE="zabbix" \
--env MYSQL_USER="zabbix" \
--env MYSQL_PASSWORD="zabbix_pwd" \
--env MYSQL_ROOT_PASSWORD="root_pwd" \
--env ZBX_JAVAGATEWAY="127.0.0.1" \
--restart=always \
--pod=zabbix \
--detach \
docker.io/zabbix/zabbix-server-mysql:${CONTAINER_TAG}
#registry.connect.redhat.com/zabbix/zabbix-server-mysql-50
podman run --name zabbix-java-gateway \
--tty \
--restart=always \
--pod=zabbix \
--detach \
docker.io/zabbix/zabbix-java-gateway:${CONTAINER_TAG}
#registry.connect.redhat.com/zabbix/zabbix-java-gateway-50
podman run --name zabbix-web-mysql \
--tty \
--env ZBX_SERVER_HOST="127.0.0.1" \
--env DB_SERVER_HOST="127.0.0.1" \
--env MYSQL_DATABASE="zabbix" \
--env MYSQL_USER="zabbix" \
--env MYSQL_PASSWORD="zabbix_pwd" \
--env MYSQL_ROOT_PASSWORD="root_pwd" \
--restart=always \
--pod=zabbix \
--detach \
docker.io/zabbix/zabbix-web-nginx-mysql:${CONTAINER_TAG}
#registry.connect.redhat.com/zabbix/zabbix-web-mysql-50
}
function down() {
podman pod stop zabbix
podman pod rm zabbix
}
operation=$1
case $operation in
up)
up
;;
down)
down
;;
*)
help_menu
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment