Docker config for Grafana & Zabbix

This commit is contained in:
Alex Thomassen 2020-04-21 14:16:31 +02:00
parent 43f3fb1e1f
commit e17f57c3b5
Signed by: Alex
GPG Key ID: 10BD786B5F6FF5DE
6 changed files with 147 additions and 2 deletions

11
Grafana/.env Normal file
View File

@ -0,0 +1,11 @@
GF_SERVER_ROOT_URL=https://grafana.hovedprosjekt.no
GF_SECURITY_ADMIN_PASSWORD="Eksempel_Passord_321"
GF_PATHS_CONFIG=/etc/grafana/grafana.ini
GF_PATHS_DATA=/var/lib/grafana
GF_PATHS_HOME=/usr/share/grafana
GF_PATHS_LOGS=/var/log/grafana
GF_PATHS_PLUGINS=/var/lib/grafana/plugins
GF_PATHS_PROVISIONING=/etc/grafana/provisioning
# Guest access
GF_AUTH_ANONYMOUS_ENABLED=true
GF_AUTH_ANONYMOUS_ORG_NAME=PublicGuest

View File

@ -0,0 +1,22 @@
version: '3.7'
services:
grafana:
# Bruk Grafana sin offisielle Docker-mal
image: grafana/grafana:latest
# Forteller Docker at den skal hente konfigurasjon (miljøvariabler) fra fil `.env`
env_file:
- .env
# Lokal mappe der Grafana-data skal lagres
volumes:
- ./grafana-storage:/var/lib/grafana
# Hvilke nettverksporter som skal "forwardes" på host.
# I dette tilfellet blir port 3000 på loopback til host sendt videre til port 3000 på container.
ports:
- "127.0.0.1:3000:3000"
# Forteller Docker at containeren skal restartes automatisk
# med mindre den er stoppet av administrator.
restart: unless-stopped
# For filrettigheter i "grafana-storage"
# 1001 er bruker-ID som ligger i `/etc/passwd` på host.
user: "1001"

View File

@ -1,4 +1,4 @@
MIT License Copyright (c) <year> <copyright holders>
MIT License Copyright (c) 2020 Alex Thomassen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,3 +1,6 @@
# Services
Konfigurasjon av diverse services for FLOT Hovedprosjekt
Konfigurasjon av diverse services for FLOT Hovedprosjekt
- [Grafana](./Grafana)
- [Zabbix](./Zabbix)

8
Zabbix/.env Normal file
View File

@ -0,0 +1,8 @@
DB_SERVER_HOST=mariadb
MYSQL_DATABASE=zabbix
MYSQL_USER=zabbix
MYSQL_PASSWORD=CUSTOM_MYSQL_ZABBIX_PASSWORD
MYSQL_ROOT_PASSWORD=CUSTOM_MYSQL_ROOT_PASSWORD
MYSQL_ROOT_HOST=%
ZBX_JAVAGATEWAY=gateway
ZBX_SERVER_HOST=zabbix-server

101
Zabbix/docker-compose.yml Normal file
View File

@ -0,0 +1,101 @@
version: '3.7'
services:
# Database-server (MariaDB)
mariadb:
image: mariadb:10.4-bionic
restart: always
# Forteller Docker at den skal hente konfigurasjon (miljøvariabler) fra fil `.env`
env_file:
- .env
# Hvilke nettverksporter som skal "forwardes" på host.
# I dette tilfellet blir port 33306 på loopback til host sendt videre til port 3306 på container.
ports:
- "127.0.0.1:33306:3306"
# Lokale mapper der data skal lagres
volumes:
- ./mariadb-data:/var/lib/mysql
- ./mariadb-cnf:/etc/mysql/conf.d
networks:
backend:
aliases:
- mariadb
- mysql-server
command: --character-set-server=utf8 --collation-server=utf8_bin
# Zabbix Java Gateway
gateway:
image: zabbix/zabbix-java-gateway:latest
restart: always
env_file:
- .env
networks:
- backend
ports:
- "10052:10052"
depends_on:
- mariadb
# Zabbix Server
# Denne Docker-malen er spesifikt satt opp for å støtte tilkobling til en MySQL/MariaDB database
zabbix-mysql:
image: zabbix/zabbix-server-mysql:latest
restart: always
networks:
backend:
aliases:
- zabbix-mysql
- zabbix-server
ports:
- "10051:10051"
env_file:
- .env
depends_on:
- mariadb
- gateway
volumes:
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro
# Zabbix Agent sammen med serveren
zabbix-agent:
image: zabbix/zabbix-agent:latest
restart: always
networks:
backend:
aliases:
- zabbix-agent
ports:
- "10050:10050"
volumes:
- ./zbx_env/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
env_file:
- .env
depends_on:
- zabbix-mysql
# Mal for Zabbix sitt web-grensesnitt med støtte for MySQL/MariaDB
nginx:
image: zabbix/zabbix-web-nginx-mysql:latest
restart: always
networks:
- backend
env_file:
- .env
ports:
- "127.0.0.1:8080:80"
depends_on:
- mariadb
volumes:
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
networks:
backend: