zabbix-server/README.md

71 lines
2.4 KiB
Markdown
Raw Normal View History

2022-09-12 10:16:24 +00:00
# zabbix-Dockerfile
2022-09-13 09:18:30 +05:00
Custom Zabbix container image.\
This has 2 images, 1 for `zabbix_server`, `nginx` and `php-pfm` based on `debian:11-slim` \
Another image that is being pulled from docker hub for mysql. \
2022-09-13 09:24:44 +05:00
Mysql files are mounted at datadir. \
2022-09-13 09:24:16 +05:00
`startservices.sh` contain script to start `zabbix_server`, `nginx` and `php-fpm`
2022-09-12 10:16:24 +00:00
## Getting started
2022-09-13 09:16:51 +05:00
- git clone and cd into git dir
- Build zabbix image
2022-09-13 09:20:42 +05:00
- cd into configdir and configure according to your set up.
2022-09-13 09:16:51 +05:00
```bash
2022-09-13 09:20:42 +05:00
git clone https://gitlab.com/alliedmaldives/ops/zabbix-dockerfile zabbix-docker
cd zabbix-docker
docker-compose up -d
xdg-open http://localhost:8000
2022-09-12 10:16:24 +00:00
```
2022-09-30 20:01:30 +05:00
## Running production
This includes database config \
copy paste this in docker-compose.yml \
run `docker compose up -d`
```
version: '3.5'
services:
#########################
zabbix:
2022-09-30 20:02:34 +05:00
image: git.shihaam.dev/dockerfiles/zabbix-server
2022-09-30 20:01:30 +05:00
volumes:
- $PWD/configdir/etc/zabbix/zabbix_server.conf:/etc/zabbix/zabbix_server.conf
- $PWD/configdir/etc/zabbix/nginx.conf:/etc/zabbix/nginx.conf
- $PWD/configdir/etc/zabbix/web/zabbix.conf.php:/etc/zabbix/web/zabbix.conf.php
- $PWD/configdir/etc/php/7.4/fpm/php-fpm.conf:/etc/php/7.4/fpm/php-fpm.conf
- $PWD/datadir/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts
- $PWD/datadir/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts
ports:
- 8000:80
- 10051:10051
restart: always
#########################
db:
image: mysql:8
environment:
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix
MYSQL_ALLOW_EMPTY_PASSWORD: true
command:
- mysqld
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_bin
- --skip-character-set-client-handshake
- --default-authentication-plugin=mysql_native_password
volumes:
- $PWD/configdir/init/init.db:/docker-entrypoint-initdb.d
- $PWD/datadir/mysql:/var/lib/mysql
restart: always
depends_on:
- zabbix
```
2022-09-30 20:02:34 +05:00
2022-09-13 09:16:51 +05:00
## To-do
- mount all needed config dirs outside container. (currently only basic configs are there)
- mount scirpt dirs outside container add alert and other custom scripts.
2022-09-13 09:24:16 +05:00
- setup proper logging.
- mount log files from nginx,php-fpm and zabbix into datadir.
2022-09-13 15:24:35 +05:00
- monitor zabbix process,kill container if zabbix dies