From 45568d6ee14ff5c517103042b398dba4b0b26669 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sat, 21 May 2022 14:37:34 -0400 Subject: Fixed issue with nginx web server. Other minor bug fixes. --- monitoring/icinga-master | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/monitoring/icinga-master b/monitoring/icinga-master index f8cedd1..32cf472 100755 --- a/monitoring/icinga-master +++ b/monitoring/icinga-master @@ -14,10 +14,15 @@ director_password="changeme" admin_user="admin" admin_password="changeme" +websrv="nginx" +#websrv="apache" + # Install packages apt install -y icinga2 icingaweb2 icinga2-ido-mysql icingaweb2-module-director \ monitoring-plugins monitoring-plugins-contrib default-mysql-server +[ "$websrv" = "nginx" ] && apt install -y nginx || apt install -y apache2 + # Secure mysql mysql_secure_installation @@ -56,11 +61,19 @@ systemctl restart icinga2 # Configure web server websrv= webstr= -[ -d /etc/apache2 ] && websrv="apache" && webstr="apache2" -[ -d /etc/nginx ] && websrv="nginx" && webstr="nginx" +[ $websrv = "apache" ] && webstr="apache2" +[ $websrv = "nginx" ] && webstr="nginx" sitefile="/etc/$webstr/sites-available/icingaweb2.conf" icingacli module enable setup -icingacli setup config webserver $websrv --file $sitefile +icingacli setup config directory +if [ "$websrv" = "nginx" ]; then + apt install -y php-fpm + echo "server {\nlisten 80;" > $sitefile + icingacli setup config webserver $websrv --fpm-uri unix:/var/run/php/php-fpm.sock >> $sitefile + echo "}" >> $sitefile +else + icingacli setup config webserver $websrv >> $sitefile +fi ln -s $sitefile /etc/$webstr/sites-enabled [ "$websrv" = "apache" ] && a2enmod ssl && a2enmod php7.4 && a2enconf icingaweb2 && a2ensite default-ssl.conf systemctl restart $webstr @@ -117,6 +130,8 @@ permissions = \"*\" " > /etc/icingaweb2/roles.ini # Configure monitoring module echo "Configuring monitoring..." +icingacli module enable monitoring +mkdir -p /etc/icingaweb2/modules/monitoring echo "[icinga] type = \"ido\" resource = \"icinga2\" @@ -137,6 +152,7 @@ protected_customvars = \"*pw*,*pass*,*community*\" # Configure director echo "Configuring director..." +mkdir -p /etc/icingaweb2/modules/director echo "[db] resource = \"director\" " > /etc/icingaweb2/modules/director/config.ini -- cgit v1.2.3