mirror of
https://github.com/bashclub/zamba-lxc-toolbox.git
synced 2024-11-07 19:31:58 +01:00
Add draft for zabbix-proxy
This commit is contained in:
parent
333d55916d
commit
69d2653e4b
52
src/zabbix-proxy/constants-service.conf
Normal file
52
src/zabbix-proxy/constants-service.conf
Normal file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# (C) 2021 Idea an concept by Christian Zengel <christian@sysops.de>
|
||||
# (C) 2021 Script design and prototype by Markus Helmke <m.helmke@nettwarker.de>
|
||||
# (C) 2021 Script rework and documentation by Thorsten Spille <thorsten@spille-edv.de>
|
||||
|
||||
# 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"
|
39
src/zabbix-proxy/install-service.sh
Normal file
39
src/zabbix-proxy/install-service.sh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Authors:
|
||||
# (C) 2021 Idea an concept by Christian Zengel <christian@sysops.de>
|
||||
# (C) 2021 Script design and prototype by Markus Helmke <m.helmke@nettwarker.de>
|
||||
# (C) 2021 Script rework and documentation by Thorsten Spille <thorsten@spille-edv.de>
|
||||
|
||||
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 <<EOF
|
||||
psql -c "CREATE USER ${ZABBIX_DB_USR} WITH PASSWORD '${ZABBIX_DB_PWD}';"
|
||||
psql -c "CREATE DATABASE ${ZABBIX_DB_NAME} ENCODING UTF8 TEMPLATE template0 OWNER ${ZABBIX_DB_USR};"
|
||||
echo "Postgres User ${ZABBIX_DB_USR} and database ${ZABBIX_DB_NAME} created."
|
||||
EOF
|
||||
|
||||
zcat /usr/share/zabbix-sql-scripts/postgresql/proxy.sql.gz | sudo -u zabbix psql ${ZABBIX_DB_NAME}
|
||||
|
||||
echo "DBPassword=${ZABBIX_DB_PWD}" >> /etc/zabbix/zabbix_server.conf
|
||||
|
||||
|
||||
systemctl enable zabbix-proxy
|
||||
|
||||
systemctl restart zabbix-proxy
|
Loading…
Reference in New Issue
Block a user