Skip to content

Commit fd75b03

Browse files
authored
Refactor (#9807)
1 parent 2abb7db commit fd75b03

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

frontend/public/json/zabbix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"interface_port": null,
1212
"documentation": "https://www.zabbix.com/documentation/current/en/manual",
1313
"website": "https://www.zabbix.com/",
14-
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@master/webp/zabbix.webp",
14+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/zabbix.webp",
1515
"config_path": "/etc/zabbix/zabbix_server.conf",
1616
"description": "Zabbix is an all-in-one monitoring solution with a variety of enterprise-grade features available right out of the box.",
1717
"install_methods": [

install/zabbix-install.sh

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ network_check
1414
update_os
1515

1616
PG_VERSION="17" setup_postgresql
17+
PG_DB_NAME="zabbixdb" PG_DB_USER="zabbix" setup_postgresql_db
1718

1819
read -rp "Choose Zabbix version [1] 7.0 LTS [2] 7.4 (Latest Stable) [3] Latest available (default: 2): " ZABBIX_CHOICE
1920
ZABBIX_CHOICE=${ZABBIX_CHOICE:-2}
@@ -35,6 +36,10 @@ curl -fsSL "$ZABBIX_DEB_URL" -o /tmp/zabbix-release_latest+debian13_all.deb
3536
$STD dpkg -i /tmp/zabbix-release_latest+debian13_all.deb
3637
$STD apt update
3738
$STD apt install -y zabbix-server-pgsql zabbix-frontend-php php8.4-pgsql zabbix-apache-conf zabbix-sql-scripts
39+
zcat /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz | sudo -u "$PG_DB_USER" psql "$PG_DB_NAME" &>/dev/null
40+
sed -i "s/^DBName=.*/DBName=$PG_DB_NAME/" /etc/zabbix/zabbix_server.conf
41+
sed -i "s/^DBUser=.*/DBUser=$PG_DB_USER/" /etc/zabbix/zabbix_server.conf
42+
sed -i "s/^# DBPassword=.*/DBPassword=$PG_DB_PASS/" /etc/zabbix/zabbix_server.conf
3843
msg_ok "Installed Zabbix $ZABBIX_VERSION"
3944

4045
while true; do
@@ -78,28 +83,6 @@ else
7883
$STD apt install -y zabbix-agent
7984
fi
8085

81-
msg_info "Setting up PostgreSQL"
82-
DB_NAME=zabbixdb
83-
DB_USER=zabbix
84-
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
85-
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
86-
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
87-
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
88-
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
89-
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
90-
{
91-
echo "Zabbix-Credentials"
92-
echo "Zabbix Database User: $DB_USER"
93-
echo "Zabbix Database Password: $DB_PASS"
94-
echo "Zabbix Database Name: $DB_NAME"
95-
} >>~/zabbix.creds
96-
97-
zcat /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz | sudo -u $DB_USER psql $DB_NAME &>/dev/null
98-
sed -i "s/^DBName=.*/DBName=$DB_NAME/" /etc/zabbix/zabbix_server.conf
99-
sed -i "s/^DBUser=.*/DBUser=$DB_USER/" /etc/zabbix/zabbix_server.conf
100-
sed -i "s/^# DBPassword=.*/DBPassword=$DB_PASS/" /etc/zabbix/zabbix_server.conf
101-
msg_ok "Set up PostgreSQL"
102-
10386
msg_info "Configuring Fping"
10487
if command -v fping >/dev/null 2>&1; then
10588
FPING_PATH=$(command -v fping)

0 commit comments

Comments
 (0)