Compare commits

...

7 Commits

Author SHA1 Message Date
CanbiZ (MickLesk) c933549393 Restart apache2 service after enabling it 2026-04-30 14:14:07 +02:00
CanbiZ (MickLesk) 5823496a23 Fix dependency installation and enable Apache modules 2026-04-30 14:04:20 +02:00
CanbiZ (MickLesk) e1b6d1bf67 Refactor Nagios update script for efficiency
Refactor Nagios update script to streamline configuration backup and restore process, and improve service management.
2026-04-30 14:03:29 +02:00
Slaviša Arežina cc3284130d Apply suggestion from @tremor021 2026-04-30 12:40:05 +02:00
Slaviša Arežina 1a14055121 Apply suggestion from @tremor021 2026-04-30 12:39:46 +02:00
Slaviša Arežina 04d95b4aee Apply suggestion from @tremor021 2026-04-30 12:38:48 +02:00
push-app-to-main[bot] f62b3b0494 Add nagios (ct) 2026-04-30 08:01:03 +00:00
3 changed files with 174 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
_ __ _
/ | / /___ _____ _(_)___ _____
/ |/ / __ `/ __ `/ / __ \/ ___/
/ /| / /_/ / /_/ / / /_/ (__ )
/_/ |_/\__,_/\__, /_/\____/____/
/____/
+90
View File
@@ -0,0 +1,90 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2026 community-scripts ORG
# Author: CanbiZ (MickLesk)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/NagiosEnterprises/nagioscore
APP="Nagios"
var_tags="${var_tags:-monitoring;alerts;infrastructure}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-20}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /usr/local/nagios/etc/nagios.cfg ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Backing up Configuration"
cp -a /usr/local/nagios/etc /opt/nagios-etc-backup
msg_ok "Backed up Configuration"
if check_for_gh_release "nagios" "NagiosEnterprises/nagioscore"; then
msg_info "Stopping Nagios"
systemctl stop nagios
msg_ok "Stopped Nagios"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "nagios" "NagiosEnterprises/nagioscore" "tarball"
msg_info "Building Nagios Core"
cd /opt/nagios
$STD ./configure --with-httpd-conf=/etc/apache2/sites-enabled
$STD make all
$STD make install-groups-users
usermod -a -G nagios www-data
$STD make install
$STD make install-daemoninit
$STD make install-commandmode
$STD make install-webconf
$STD a2enmod rewrite
$STD a2enmod cgi
msg_ok "Built Nagios Core"
msg_info "Starting Nagios"
systemctl restart apache2
systemctl start nagios
msg_ok "Started Nagios"
fi
if check_for_gh_release "nagios-plugins" "nagios-plugins/nagios-plugins"; then
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "nagios-plugins" "nagios-plugins/nagios-plugins" "tarball"
msg_info "Building Nagios Plugins"
cd /opt/nagios-plugins
$STD ./tools/setup
$STD ./configure
$STD make
$STD make install
msg_ok "Built Nagios Plugins"
fi
msg_info "Restoring Configuration"
rm -rf /usr/local/nagios/etc
cp -a /opt/nagios-etc-backup /usr/local/nagios/etc
rm -rf /opt/nagios-etc-backup
msg_ok "Restored Configuration"
msg_ok "Updated successfully!"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}/nagios${CL}"
+78
View File
@@ -0,0 +1,78 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: CanbiZ (MickLesk)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/NagiosEnterprises/nagioscore
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
autoconf \
automake \
build-essential \
bc \
dc \
gawk \
gettext \
gperf \
libgd-dev \
libmcrypt-dev \
libnet-snmp-perl \
libssl-dev \
snmp \
apache2 \
apache2-utils
msg_ok "Installed Dependencies"
PHP_APACHE="YES" setup_php
fetch_and_deploy_gh_release "nagios" "NagiosEnterprises/nagioscore" "tarball"
msg_info "Building Nagios Core"
cd /opt/nagios
$STD ./configure --with-httpd-conf=/etc/apache2/sites-enabled
$STD make all
$STD make install-groups-users
usermod -a -G nagios www-data
$STD make install
$STD make install-daemoninit
$STD make install-commandmode
$STD make install-config
$STD make install-webconf
$STD a2enmod rewrite
$STD a2enmod cgi
msg_ok "Built Nagios Core"
fetch_and_deploy_gh_release "nagios-plugins" "nagios-plugins/nagios-plugins" "tarball"
msg_info "Building Nagios Plugins"
cd /opt/nagios-plugins
$STD ./tools/setup
$STD ./configure
$STD make
$STD make install
msg_ok "Built Nagios Plugins"
msg_info "Configuring Web Authentication"
$STD htpasswd -bc /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadmin
chown root:www-data /usr/local/nagios/etc/htpasswd.users
chmod 640 /usr/local/nagios/etc/htpasswd.users
msg_ok "Configured Web Authentication"
msg_info "Starting Services"
systemctl enable -q apache2
systemctl restart apache2
systemctl enable -q --now nagios
msg_ok "Started Services"
motd_ssh
customize
cleanup_lxc