From a271005a699edb1932890613672044b36125ad0c Mon Sep 17 00:00:00 2001 From: MickLesk Date: Sat, 25 Apr 2026 22:37:05 +0200 Subject: [PATCH] dev; nagios --- .gitignore | 2 ++ ct/nagios.sh | 53 +++++++++++++++++++++++++++++++++++++++ install/nagios-install.sh | 36 ++++++++++++++++++++++++++ json/nagios.json | 44 ++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 ct/nagios.sh create mode 100644 install/nagios-install.sh create mode 100644 json/nagios.json diff --git a/.gitignore b/.gitignore index 3c51ccf2..fb667408 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ vm/debian-13-vm.sh vm/vm-manager.sh vm/vm-manager.sh vm/debian-13-vm.sh +stars.json +stars.txt diff --git a/ct/nagios.sh b/ct/nagios.sh new file mode 100644 index 00000000..0e2bd594 --- /dev/null +++ b/ct/nagios.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: GitHub Copilot (GPT-5.3-Codex) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/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 /etc/nagios4/nagios.cfg ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + msg_info "Updating Nagios Packages" + $STD apt update + $STD apt install -y --only-upgrade nagios4 nagios-plugins-contrib apache2 + msg_ok "Updated Nagios Packages" + + msg_info "Restarting Services" + systemctl restart nagios4 + systemctl restart apache2 + msg_ok "Restarted Services" + + 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}/nagios4${CL}" diff --git a/install/nagios-install.sh b/install/nagios-install.sh new file mode 100644 index 00000000..93b6d09a --- /dev/null +++ b/install/nagios-install.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: GitHub Copilot (GPT-5.3-Codex) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/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 \ + apache2-utils \ + nagios4 \ + nagios-plugins-contrib +msg_ok "Installed Dependencies" + +msg_info "Configuring Web Authentication" +htpasswd -bc /etc/nagios4/htpasswd.users nagiosadmin nagiosadmin +chown root:www-data /etc/nagios4/htpasswd.users +chmod 640 /etc/nagios4/htpasswd.users +msg_ok "Configured Web Authentication" + +msg_info "Starting Services" +systemctl enable -q --now nagios4 +systemctl enable -q --now apache2 +msg_ok "Started Services" + +motd_ssh +customize +cleanup_lxc diff --git a/json/nagios.json b/json/nagios.json new file mode 100644 index 00000000..37582b04 --- /dev/null +++ b/json/nagios.json @@ -0,0 +1,44 @@ +{ + "name": "Nagios Core", + "slug": "nagios", + "categories": [ + 9 + ], + "date_created": "2026-04-25", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/quickstart.html", + "website": "https://www.nagios.org/projects/nagios-core/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/nagios.webp", + "description": "Nagios Core is an open-source monitoring platform for hosts, services, and network infrastructure with a classic web interface.", + "install_methods": [ + { + "type": "default", + "script": "ct/nagios.sh", + "config_path": "/etc/nagios4/nagios.cfg", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 20, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": "nagiosadmin", + "password": "nagiosadmin" + }, + "notes": [ + { + "text": "After first login, change the default web password in /etc/nagios4/htpasswd.users.", + "type": "warning" + }, + { + "text": "Web UI path is /nagios4 on port 80.", + "type": "info" + } + ] +}