This commit is contained in:
Slaviša Arežina
2025-12-09 16:03:43 +01:00
committed by GitHub
parent 2abb7db794
commit fd75b03435
2 changed files with 6 additions and 23 deletions

View File

@ -11,7 +11,7 @@
"interface_port": null, "interface_port": null,
"documentation": "https://www.zabbix.com/documentation/current/en/manual", "documentation": "https://www.zabbix.com/documentation/current/en/manual",
"website": "https://www.zabbix.com/", "website": "https://www.zabbix.com/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@master/webp/zabbix.webp", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/zabbix.webp",
"config_path": "/etc/zabbix/zabbix_server.conf", "config_path": "/etc/zabbix/zabbix_server.conf",
"description": "Zabbix is an all-in-one monitoring solution with a variety of enterprise-grade features available right out of the box.", "description": "Zabbix is an all-in-one monitoring solution with a variety of enterprise-grade features available right out of the box.",
"install_methods": [ "install_methods": [

View File

@ -14,6 +14,7 @@ network_check
update_os update_os
PG_VERSION="17" setup_postgresql PG_VERSION="17" setup_postgresql
PG_DB_NAME="zabbixdb" PG_DB_USER="zabbix" setup_postgresql_db
read -rp "Choose Zabbix version [1] 7.0 LTS [2] 7.4 (Latest Stable) [3] Latest available (default: 2): " ZABBIX_CHOICE read -rp "Choose Zabbix version [1] 7.0 LTS [2] 7.4 (Latest Stable) [3] Latest available (default: 2): " ZABBIX_CHOICE
ZABBIX_CHOICE=${ZABBIX_CHOICE:-2} ZABBIX_CHOICE=${ZABBIX_CHOICE:-2}
@ -35,6 +36,10 @@ curl -fsSL "$ZABBIX_DEB_URL" -o /tmp/zabbix-release_latest+debian13_all.deb
$STD dpkg -i /tmp/zabbix-release_latest+debian13_all.deb $STD dpkg -i /tmp/zabbix-release_latest+debian13_all.deb
$STD apt update $STD apt update
$STD apt install -y zabbix-server-pgsql zabbix-frontend-php php8.4-pgsql zabbix-apache-conf zabbix-sql-scripts $STD apt install -y zabbix-server-pgsql zabbix-frontend-php php8.4-pgsql zabbix-apache-conf zabbix-sql-scripts
zcat /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz | sudo -u "$PG_DB_USER" psql "$PG_DB_NAME" &>/dev/null
sed -i "s/^DBName=.*/DBName=$PG_DB_NAME/" /etc/zabbix/zabbix_server.conf
sed -i "s/^DBUser=.*/DBUser=$PG_DB_USER/" /etc/zabbix/zabbix_server.conf
sed -i "s/^# DBPassword=.*/DBPassword=$PG_DB_PASS/" /etc/zabbix/zabbix_server.conf
msg_ok "Installed Zabbix $ZABBIX_VERSION" msg_ok "Installed Zabbix $ZABBIX_VERSION"
while true; do while true; do
@ -78,28 +83,6 @@ else
$STD apt install -y zabbix-agent $STD apt install -y zabbix-agent
fi fi
msg_info "Setting up PostgreSQL"
DB_NAME=zabbixdb
DB_USER=zabbix
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
{
echo "Zabbix-Credentials"
echo "Zabbix Database User: $DB_USER"
echo "Zabbix Database Password: $DB_PASS"
echo "Zabbix Database Name: $DB_NAME"
} >>~/zabbix.creds
zcat /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz | sudo -u $DB_USER psql $DB_NAME &>/dev/null
sed -i "s/^DBName=.*/DBName=$DB_NAME/" /etc/zabbix/zabbix_server.conf
sed -i "s/^DBUser=.*/DBUser=$DB_USER/" /etc/zabbix/zabbix_server.conf
sed -i "s/^# DBPassword=.*/DBPassword=$DB_PASS/" /etc/zabbix/zabbix_server.conf
msg_ok "Set up PostgreSQL"
msg_info "Configuring Fping" msg_info "Configuring Fping"
if command -v fping >/dev/null 2>&1; then if command -v fping >/dev/null 2>&1; then
FPING_PATH=$(command -v fping) FPING_PATH=$(command -v fping)