summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2022-05-21 14:37:34 -0400
committerSam Chudnick <sam@chudnick.com>2022-05-21 14:37:34 -0400
commit45568d6ee14ff5c517103042b398dba4b0b26669 (patch)
treea70ec7e6dc91f50d93249e4685990eb89131be81
parent9a14ebe66f7c443ca24474a6242151b5f4fac06b (diff)
Fixed issue with nginx web server. Other minor bug fixes.
-rwxr-xr-xmonitoring/icinga-master22
1 files 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"
14admin_user="admin" 14admin_user="admin"
15admin_password="changeme" 15admin_password="changeme"
16 16
17websrv="nginx"
18#websrv="apache"
19
17# Install packages 20# Install packages
18apt install -y icinga2 icingaweb2 icinga2-ido-mysql icingaweb2-module-director \ 21apt install -y icinga2 icingaweb2 icinga2-ido-mysql icingaweb2-module-director \
19 monitoring-plugins monitoring-plugins-contrib default-mysql-server 22 monitoring-plugins monitoring-plugins-contrib default-mysql-server
20 23
24[ "$websrv" = "nginx" ] && apt install -y nginx || apt install -y apache2
25
21# Secure mysql 26# Secure mysql
22mysql_secure_installation 27mysql_secure_installation
23 28
@@ -56,11 +61,19 @@ systemctl restart icinga2
56# Configure web server 61# Configure web server
57websrv= 62websrv=
58webstr= 63webstr=
59[ -d /etc/apache2 ] && websrv="apache" && webstr="apache2" 64[ $websrv = "apache" ] && webstr="apache2"
60[ -d /etc/nginx ] && websrv="nginx" && webstr="nginx" 65[ $websrv = "nginx" ] && webstr="nginx"
61sitefile="/etc/$webstr/sites-available/icingaweb2.conf" 66sitefile="/etc/$webstr/sites-available/icingaweb2.conf"
62icingacli module enable setup 67icingacli module enable setup
63icingacli setup config webserver $websrv --file $sitefile 68icingacli setup config directory
69if [ "$websrv" = "nginx" ]; then
70 apt install -y php-fpm
71 echo "server {\nlisten 80;" > $sitefile
72 icingacli setup config webserver $websrv --fpm-uri unix:/var/run/php/php-fpm.sock >> $sitefile
73 echo "}" >> $sitefile
74else
75 icingacli setup config webserver $websrv >> $sitefile
76fi
64ln -s $sitefile /etc/$webstr/sites-enabled 77ln -s $sitefile /etc/$webstr/sites-enabled
65[ "$websrv" = "apache" ] && a2enmod ssl && a2enmod php7.4 && a2enconf icingaweb2 && a2ensite default-ssl.conf 78[ "$websrv" = "apache" ] && a2enmod ssl && a2enmod php7.4 && a2enconf icingaweb2 && a2ensite default-ssl.conf
66systemctl restart $webstr 79systemctl restart $webstr
@@ -117,6 +130,8 @@ permissions = \"*\" " > /etc/icingaweb2/roles.ini
117 130
118# Configure monitoring module 131# Configure monitoring module
119echo "Configuring monitoring..." 132echo "Configuring monitoring..."
133icingacli module enable monitoring
134mkdir -p /etc/icingaweb2/modules/monitoring
120echo "[icinga] 135echo "[icinga]
121type = \"ido\" 136type = \"ido\"
122resource = \"icinga2\" 137resource = \"icinga2\"
@@ -137,6 +152,7 @@ protected_customvars = \"*pw*,*pass*,*community*\"
137 152
138# Configure director 153# Configure director
139echo "Configuring director..." 154echo "Configuring director..."
155mkdir -p /etc/icingaweb2/modules/director
140echo "[db] 156echo "[db]
141resource = \"director\" 157resource = \"director\"
142" > /etc/icingaweb2/modules/director/config.ini 158" > /etc/icingaweb2/modules/director/config.ini