Add munin-apache vhost and icinga vhost.. fix bug in munin.conf
authorAndy Witter <awitter@georgialibraries.org>
Tue, 5 Nov 2013 21:40:30 +0000 (16:40 -0500)
committerAndy Witter <awitter@georgialibraries.org>
Tue, 5 Nov 2013 21:40:30 +0000 (16:40 -0500)
GenaSYS.sh
templates/monitor/icinga-vhost.conf [new file with mode: 0644]
templates/monitor/munin-apache2.conf [new file with mode: 0644]
templates/monitor/munin.conf
templates/setup-functions
templates/setup.sh

index 7fe6e70..f7c1e27 100755 (executable)
@@ -25,8 +25,8 @@
     PURPOSE_="Generate config files needed for Evergreen-ILS Cluster"
    SYNOPSIS_="$NAME_"
    REQUIRES_="standard GNU commands, apt, dpkg"
-    VERSION_="1.19"
-       DATE_="2010-09-23; last update: 2013-11-04"
+    VERSION_="1.20"
+       DATE_="2010-09-23; last update: 2013-11-05"
      AUTHOR_="Andy Witter <awitter@georgialibraries.org>"
         URL_="http://evergreen-ils.org"
    CATEGORY_="devel"
@@ -1611,7 +1611,7 @@ for BRICK in $(seq $BRICKCOUNT)
        #eval echo "host \$BRICKHOSTNAME${BRICK}_HEAD_IP" >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/munin/munin-node.conf
 
         ### Build munin.conf file. 
-        eval echo -e "[${CLUSTERDOMAINNAME}\;\$BRICKHOSTNAME${BRICK}-head]" >>$TMPMUNINCONF
+        eval echo -e "[${CLUSTERDOMAINNAME}\;\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}]" >>$TMPMUNINCONF
         #eval echo -e "\\\taddress \$BRICKHOSTNAME${BRICK}_HEAD_IP" >>$TMPMUNINCONF
        eval echo -e "\\\taddress \$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}" >>$TMPMUNINCONF
         #eval echo -e "\\\thost_name \$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}" >>$TMPMUNINCONF
@@ -1743,7 +1743,7 @@ for BRICK in $(seq $BRICKCOUNT)
         #eval echo "host \$BRICKHOSTNAME${BRICK}_HEAD_IP" >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK})-head/etc/munin/munin-node.conf
         
         ### Build munin.conf file. 
-       eval echo -e "[${CLUSTERDOMAINNAME}\;\$BRICKHOSTNAME${BRICK}-head]" >>$TMPMUNINCONF
+       eval echo -e "[${CLUSTERDOMAINNAME}\;\$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}]" >>$TMPMUNINCONF
         #eval echo -e "\\\taddress \$BRICKHOSTNAME${BRICK}_HEAD_IP" >>$TMPMUNINCONF
        eval echo -e "\\\taddress \$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}" >>$TMPMUNINCONF
        #eval echo -e "\\\thost_name \$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}" >>$TMPMUNINCONF
@@ -1838,7 +1838,7 @@ for BRICK in $(seq $BRICKCOUNT)
                 #eval echo "host \$BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP" >> ${OUTDIR}/$(eval echo \$BRICKHOSTNAME${BRICK})/$(eval echo \$BRICKHOSTNAME${BRICK}-drone0${DRONE})/etc/munin/munin-node.conf
 
                ### Build munin.conf file. 
-               eval echo -e "[${CLUSTERDOMAINNAME}\;\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}]" >>$TMPMUNINCONF
+               eval echo -e "[${CLUSTERDOMAINNAME}\;\$BRICKHOSTNAME${BRICK}_DRONE${DRONE}.${CLUSTERDOMAINNAME}]" >>$TMPMUNINCONF
                #eval echo -e "\\\taddress \$BRICKHOSTNAME${BRICK}_DRONE${DRONE}_IP" >>$TMPMUNINCONF
                eval echo -e "\\\taddress \$BRICKHOSTNAME${BRICK}_DRONE${DRONE}.${CLUSTERDOMAINNAME}" >>$TMPMUNINCONF
                #eval echo -e "\\\thost_name \$BRICKHOSTNAME${BRICK}-head.${CLUSTERDOMAINNAME}" >>$TMPMUNINCONF
@@ -2330,9 +2330,12 @@ GenHostGroup "ssh-servers" "SSH Servers" "*"
 for MONITOR in $MACHINES_MONITOR
 do
        mkdir -p "$OUTDIR/$MONITOR/etc/icinga/objects"
+       mkdir -p "$OUTDIR/$MONITOR/etc/apache2/sites-available"
+       cp -f "$TEMPLATEDIR/monitor/icinga-vhost.conf" "/etc/apache2/sites-available"
        cp -f "$TMPFOLDER/hosts.cfg" "$OUTDIR/$MONITOR/etc/icinga/objects"
        cp -f "$TMPFOLDER/hostgroups.cfg" "$OUTDIR/$MONITOR/etc/icinga/objects"
        cp -f "$TEMPLATEDIR/monitor/services.cfg" "$OUTDIR/$MONITOR/etc/icinga/objects"
+       sed -i "s^CLUSTER_DOMAIN_NAME^${CLUSTERDOMAINNAME}^g" "$OUTDIR/$MONITOR/etc/apache2/sites-available/icinga-vhost.conf"
        #cp -f "$TEMPLATEDIR/monitor/commands.cfg" "$OUTDIR/$MONITOR/etc/icinga"
 
        ### Generate sources.list for apt to install icinga
@@ -2415,6 +2418,8 @@ for MONITOR in ${MACHINES_MONITOR}
 do
        mkdir -p "$OUTDIR/$MONITOR/etc/munin"
        mkdir -p "$OUTDIR/$MONITOR/etc/apache2/sites-available"
+       mkdir -p "$OUTDIR/$MONITOR/etc/apache2/conf.d"
+       cp -f "$TEMPLATEDIR/monitor/munin-apache2.conf" "$OUTDIR/$MONITOR/etc/apache2/conf.d"
        cp -f "$TMPMUNINCONF" "$OUTDIR/$MONITOR/etc/munin"
        cp -f "$TEMPLATEDIR/monitor/munin-vhost.conf" "$OUTDIR/$MONITOR/etc/apache2/sites-available"
        sed -i "s^CLUSTER_DOMAIN_NAME^${CLUSTERDOMAINNAME}^g" "$OUTDIR/$MONITOR/etc/apache2/sites-available/munin-vhost.conf"
diff --git a/templates/monitor/icinga-vhost.conf b/templates/monitor/icinga-vhost.conf
new file mode 100644 (file)
index 0000000..9bb403c
--- /dev/null
@@ -0,0 +1,24 @@
+<VirtualHost *:80>
+   ServerAdmin webmaster@CLUSTER_DOMAIN_NAME
+   ServerName icinga.CLUSTER_DOMAIN_NAME
+   DocumentRoot /usr/share/icinga/htdocs
+
+   ScriptAlias /cgi-bin/icinga /usr/lib/cgi-bin/icinga
+
+   # Where the stylesheets (config files) reside
+   Alias /stylesheets /etc/icinga/stylesheets
+   Alias /icinga/stylesheets /etc/icinga/stylesheets
+
+   # Where the HTML pages live
+   Alias /icinga /usr/share/icinga/htdocs
+
+   <DirectoryMatch "^(?:/usr/share/icinga/htdocs|/usr/lib/cgi-bin/icinga|/etc/icinga/stylesheets)/">
+       Options FollowSymLinks
+       AllowOverride None
+   </DirectoryMatch>
+   LogLevel notice
+   CustomLog /var/log/apache2/access.log combined
+   ErrorLog /var/log/apache2/error.log
+   ServerSignature On
+</VirtualHost>
+
diff --git a/templates/monitor/munin-apache2.conf b/templates/monitor/munin-apache2.conf
new file mode 100644 (file)
index 0000000..6f9d38d
--- /dev/null
@@ -0,0 +1,17 @@
+# Where the HTML pages live
+Alias /munin /var/cache/munin/www
+
+<DirectoryMatch "/var/cache/munin/www">
+        Options FollowSymLinks
+
+        DirectoryIndex index.html
+
+        AllowOverride AuthConfig
+        Order Allow,Deny
+        Allow From All
+
+        #AuthName "Munin Access"
+        #AuthType Basic
+        #AuthUserFile /etc/munin/htpasswd.users
+        #Require valid-user
+</DirectoryMatch>
index 6a186e7..ef3d15b 100644 (file)
@@ -1,6 +1,6 @@
 ### Configfile for Munin master
 dbdir       /var/lib/munin
-htmldir     /var/www/munin
+htmldir     /var/cache/munin/www
 logdir      /var/log/munin
 rundir      /var/run/munin
 
index 3964b91..e79b213 100644 (file)
@@ -103,11 +103,18 @@ then
         fi
 fi
 ## Munin on monitor servers.
-if [ -e "$WD/Munin/munin-cron.crontab" ]
+if [ -e "$WD/Munin/munin-cron.crontab" ] ### This file only should exist on a monitoring server.
 then
-       crontab -u munin "$WD/Munin/munin-cron.crontab"
-else
-       echo "Cannot install crontab for munin"
+       if crontab -u munin "$WD/Munin/munin-cron.crontab"
+       then
+               sleep 2
+               echo "Running munin-cron manually for first time."
+               echo "This may take a while the first time..."
+               sudo su -c munin-cron --shell=/bin/bash munin
+       else    
+               echo "Failed to install crontab for munin.  Not running"
+               echo "munin-cron to populate the web directory."
+       fi
 fi
 
 
index c4ceb68..29d8db6 100755 (executable)
@@ -654,6 +654,12 @@ then
        a2ensite munin-vhost.conf
 fi
 
+## Setup Apache2 for Icinga
+if [ -e /etc/apache2/sites-available/icinga-vhost.conf ]
+then   
+        a2ensite icinga-vhost.conf
+fi
+
 ### Enhance bashrc for root.
 cat > bashrc-options.txt << EOF