Compare commits

..

6 Commits

Author SHA1 Message Date
tteckster 5e5e2c96a5
Update CHANGELOG.md 2024-06-11 15:47:26 -04:00
tteckster 7ea8bdfb95
Update zabbix-install.sh
tweak
2024-06-11 15:25:47 -04:00
tteckster 79b138cc6d
Update zabbix-install.sh
tweak
2024-06-11 14:19:41 -04:00
tteckster fd114369e9
Update zabbix-install.sh
Escape Special Characters
2024-06-11 13:50:59 -04:00
tteckster 5bc0ddda22
Create zabbix-install.sh 2024-06-11 13:31:22 -04:00
tteckster 9a3a05f75a
Create zabbix.sh 2024-06-11 13:30:12 -04:00
3 changed files with 141 additions and 0 deletions

View File

@ -9,6 +9,13 @@
- All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment. - All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment.
## 2024-06-11
### Changed
- **Zabbix LXC**
- NEW Script
## 2024-06-06 ## 2024-06-06
### Changed ### Changed

71
ct/zabbix.sh Normal file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
# Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info {
clear
cat <<"EOF"
_____ __ __ _
/__ / ____ _/ /_ / /_ (_) __
/ / / __ `/ __ \/ __ \/ / |/_/
/ /__/ /_/ / /_/ / /_/ / /> <
/____/\__,_/_.___/_.___/_/_/|_|
EOF
}
header_info
echo -e "Loading..."
APP="Zabbix"
var_disk="6"
var_cpu="2"
var_ram="4096"
var_os="debian"
var_version="12"
variables
color
catch_errors
function default_settings() {
CT_TYPE="1"
PW=""
CT_ID=$NEXTID
HN=$NSAPP
DISK_SIZE="$var_disk"
CORE_COUNT="$var_cpu"
RAM_SIZE="$var_ram"
BRG="vmbr0"
NET="dhcp"
GATE=""
APT_CACHER=""
APT_CACHER_IP=""
DISABLEIP6="no"
MTU=""
SD=""
NS=""
MAC=""
VLAN=""
SSH="no"
VERB="no"
echo_default
}
function update_script() {
header_info
if [[ ! -f /etc/zabbix/zabbix_server.conf ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Updating $APP LXC"
apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null
msg_ok "Updated $APP LXC"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${APP} should be reachable by going to the following URL.
${BL}http://${IP}/zabbix${CL} \n"

63
install/zabbix-install.sh Normal file
View File

@ -0,0 +1,63 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl
$STD apt-get install -y sudo
$STD apt-get install -y mc
msg_ok "Installed Dependencies"
msg_info "Installing Zabbix"
wget -q https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian12_all.deb
$STD dpkg -i zabbix-release_7.0-1+debian12_all.deb
rm zabbix-release_7.0-1+debian12_all.deb
$STD apt-get update
$STD apt-get install -y zabbix-server-pgsql zabbix-frontend-php php8.2-pgsql zabbix-apache-conf zabbix-sql-scripts zabbix-agent
msg_ok "Installed Zabbix"
msg_info "Setting up PostgreSQL"
$STD apt-get install -y 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'"
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
echo "" >~/zabbix.creds
echo "zabbix Database Credentials" >>~/zabbix.creds
echo "" >>~/zabbix.creds
echo -e "zabbix Database User: \e[32m$DB_USER\e[0m" >>~/zabbix.creds
echo -e "zabbix Database Password: \e[32m$DB_PASS\e[0m" >>~/zabbix.creds
echo -e "zabbix Database Name: \e[32m$DB_NAME\e[0m" >>~/zabbix.creds
msg_ok "Set up PostgreSQL"
msg_info "Starting Services"
systemctl restart zabbix-server zabbix-agent apache2
systemctl enable -q zabbix-server zabbix-agent apache2
msg_ok "Started Services"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"