mirror of https://github.com/tteck/Proxmox.git
Compare commits
6 Commits
21c1240c8c
...
5e5e2c96a5
Author | SHA1 | Date |
---|---|---|
|
5e5e2c96a5 | |
|
7ea8bdfb95 | |
|
79b138cc6d | |
|
fd114369e9 | |
|
5bc0ddda22 | |
|
9a3a05f75a |
|
@ -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
|
||||||
|
|
|
@ -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"
|
|
@ -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"
|
Loading…
Reference in New Issue