diff options
author | Sam Chudnick <sam@chudnick.com> | 2022-05-21 14:37:34 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2022-05-21 14:37:34 -0400 |
commit | 45568d6ee14ff5c517103042b398dba4b0b26669 (patch) | |
tree | a70ec7e6dc91f50d93249e4685990eb89131be81 | |
parent | 9a14ebe66f7c443ca24474a6242151b5f4fac06b (diff) |
Fixed issue with nginx web server. Other minor bug fixes.
-rwxr-xr-x | monitoring/icinga-master | 22 |
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" | |||
14 | admin_user="admin" | 14 | admin_user="admin" |
15 | admin_password="changeme" | 15 | admin_password="changeme" |
16 | 16 | ||
17 | websrv="nginx" | ||
18 | #websrv="apache" | ||
19 | |||
17 | # Install packages | 20 | # Install packages |
18 | apt install -y icinga2 icingaweb2 icinga2-ido-mysql icingaweb2-module-director \ | 21 | apt 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 |
22 | mysql_secure_installation | 27 | mysql_secure_installation |
23 | 28 | ||
@@ -56,11 +61,19 @@ systemctl restart icinga2 | |||
56 | # Configure web server | 61 | # Configure web server |
57 | websrv= | 62 | websrv= |
58 | webstr= | 63 | webstr= |
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" |
61 | sitefile="/etc/$webstr/sites-available/icingaweb2.conf" | 66 | sitefile="/etc/$webstr/sites-available/icingaweb2.conf" |
62 | icingacli module enable setup | 67 | icingacli module enable setup |
63 | icingacli setup config webserver $websrv --file $sitefile | 68 | icingacli setup config directory |
69 | if [ "$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 | ||
74 | else | ||
75 | icingacli setup config webserver $websrv >> $sitefile | ||
76 | fi | ||
64 | ln -s $sitefile /etc/$webstr/sites-enabled | 77 | ln -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 |
66 | systemctl restart $webstr | 79 | systemctl restart $webstr |
@@ -117,6 +130,8 @@ permissions = \"*\" " > /etc/icingaweb2/roles.ini | |||
117 | 130 | ||
118 | # Configure monitoring module | 131 | # Configure monitoring module |
119 | echo "Configuring monitoring..." | 132 | echo "Configuring monitoring..." |
133 | icingacli module enable monitoring | ||
134 | mkdir -p /etc/icingaweb2/modules/monitoring | ||
120 | echo "[icinga] | 135 | echo "[icinga] |
121 | type = \"ido\" | 136 | type = \"ido\" |
122 | resource = \"icinga2\" | 137 | resource = \"icinga2\" |
@@ -137,6 +152,7 @@ protected_customvars = \"*pw*,*pass*,*community*\" | |||
137 | 152 | ||
138 | # Configure director | 153 | # Configure director |
139 | echo "Configuring director..." | 154 | echo "Configuring director..." |
155 | mkdir -p /etc/icingaweb2/modules/director | ||
140 | echo "[db] | 156 | echo "[db] |
141 | resource = \"director\" | 157 | resource = \"director\" |
142 | " > /etc/icingaweb2/modules/director/config.ini | 158 | " > /etc/icingaweb2/modules/director/config.ini |