From 69d2653e4b2a7f835b38295e87cdee89ecdc03eb Mon Sep 17 00:00:00 2001 From: Thorsten Spille Date: Thu, 16 May 2024 12:03:29 +0200 Subject: [PATCH] Add draft for zabbix-proxy --- src/zabbix-proxy/constants-service.conf | 52 +++++++++++++++++++++++++ src/zabbix-proxy/install-service.sh | 39 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 src/zabbix-proxy/constants-service.conf create mode 100644 src/zabbix-proxy/install-service.sh diff --git a/src/zabbix-proxy/constants-service.conf b/src/zabbix-proxy/constants-service.conf new file mode 100644 index 0000000..07b8f78 --- /dev/null +++ b/src/zabbix-proxy/constants-service.conf @@ -0,0 +1,52 @@ +#!/bin/bash + +# Authors: +# (C) 2021 Idea an concept by Christian Zengel +# (C) 2021 Script design and prototype by Markus Helmke +# (C) 2021 Script rework and documentation by Thorsten Spille + +# This file contains the project constants on service level + +# Debian Version, which will be installed +LXC_TEMPLATE_VERSION="debian-12-standard" + +# Create sharefs mountpoint +LXC_MP=0 +# Defines the mountpoint of the filesystem shared by Zamba inside your LXC container (default: tank) +LXC_SHAREFS_MOUNTPOINT="data" +# Defines the recordsize of mp0 +LXC_MP_RECORDSIZE="16K" + +# Create unprivileged container +LXC_UNPRIVILEGED="1" + +# enable nesting feature +LXC_NESTING="1" + +# enable keyctl feature +LXC_KEYCTL="0" + + +# Defines the IP from the SQL server +ZABBIX_DB_IP="127.0.0.1" + +# Defines the PORT from the SQL server +ZABBIX_DB_PORT="5432" + +# Defines the name from the SQL database +ZABBIX_DB_NAME="zabbix" + +# Defines the name from the SQL user +ZABBIX_DB_USR="zabbix" + +# Build a strong password for the SQL user - could be overwritten with something fixed +ZABBIX_DB_PWD="$(random_password)" + +ZABBIX_VERSION=6.5 #zabbix 7 beta +POSTGRES_VERSION=16 #postgres repo, latest release (2024-05-13) + +# Sets the minimum amount of RAM the service needs for operation +LXC_MEM_MIN=4096 + +# service dependent meta tags +SERVICE_TAGS="php-fpm,nginx,postgresql" \ No newline at end of file diff --git a/src/zabbix-proxy/install-service.sh b/src/zabbix-proxy/install-service.sh new file mode 100644 index 0000000..0fa0fc0 --- /dev/null +++ b/src/zabbix-proxy/install-service.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Authors: +# (C) 2021 Idea an concept by Christian Zengel +# (C) 2021 Script design and prototype by Markus Helmke +# (C) 2021 Script rework and documentation by Thorsten Spille + +set -euo pipefail + +source /root/functions.sh +source /root/zamba.conf +source /root/constants-service.conf + +apt_repo "zabbix" "https://repo.zabbix.com/zabbix-official-repo.key" "https://repo.zabbix.com/zabbix/${ZABBIX_VERSION}/debian/ $(lsb_release -cs) main" +apt_repo "postgresql" "https://www.postgresql.org/media/keys/ACCC4CF8.asc" "http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" + +apt update + +DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq dist-upgrade +DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq install --no-install-recommends postgresql-$POSTGRES_VERSION postgresql-client zabbix-proxy-pgsql zabbix-sql-scripts ssl-cert + +timedatectl set-timezone ${LXC_TIMEZONE} + +systemctl enable --now postgresql + +su - postgres <> /etc/zabbix/zabbix_server.conf + + +systemctl enable zabbix-proxy + +systemctl restart zabbix-proxy \ No newline at end of file