diff --git a/Grafana/.env b/Grafana/.env new file mode 100644 index 0000000..c09169c --- /dev/null +++ b/Grafana/.env @@ -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 \ No newline at end of file diff --git a/Grafana/docker-compose.yml b/Grafana/docker-compose.yml new file mode 100644 index 0000000..e0a7f40 --- /dev/null +++ b/Grafana/docker-compose.yml @@ -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" \ No newline at end of file diff --git a/LICENSE b/LICENSE index 204b93d..d3a5e15 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -MIT License Copyright (c) +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 diff --git a/README.md b/README.md index d702e6c..bf4567e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # Services -Konfigurasjon av diverse services for FLOT Hovedprosjekt \ No newline at end of file +Konfigurasjon av diverse services for FLOT Hovedprosjekt + +- [Grafana](./Grafana) +- [Zabbix](./Zabbix) \ No newline at end of file diff --git a/Zabbix/.env b/Zabbix/.env new file mode 100644 index 0000000..455c872 --- /dev/null +++ b/Zabbix/.env @@ -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 \ No newline at end of file diff --git a/Zabbix/docker-compose.yml b/Zabbix/docker-compose.yml new file mode 100644 index 0000000..976c7e6 --- /dev/null +++ b/Zabbix/docker-compose.yml @@ -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: