summaryrefslogtreecommitdiff
path: root/monitoring/icinga-master
diff options
context:
space:
mode:
Diffstat (limited to 'monitoring/icinga-master')
-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