add monitoring configuration
authorAndy Witter <awitter@georgialibraries.org>
Fri, 3 May 2013 14:20:58 +0000 (10:20 -0400)
committerAndy Witter <awitter@georgialibraries.org>
Fri, 3 May 2013 14:20:58 +0000 (10:20 -0400)
templates/setup-drone.sh
templates/setup-head.sh
templates/setup.sh

index fed7851..fa27d1b 100755 (executable)
@@ -189,6 +189,22 @@ sleep 1
 /etc/init.d/opensrf restart
 }
 
+### Setup Monitoring
+## Monitored hosts
+if [ -e /etc/nagios/nrpe.cfg ]
+then
+        if [ -e ./.setup_monitoring.sh ]
+        then
+                mkdir -p /etc/nagios
+                ./.setup_monitoring.sh
+        else
+                echo
+                echo "Cannot configure monitoring"
+                echo ".setup_monitoring.sh is missing."
+        fi
+fi
+
+
 echo
 echo "Done! This system is now a drone"
 echo hostname for this drone is $(cat /etc/hostname)
index ed5cc04..87f2dc3 100755 (executable)
@@ -345,6 +345,21 @@ echo -e "alias attach='su - -c \"brick_ctl.sh -a attach_brick\" opensrf'" >> /ro
 echo 'PS1="\[\033[1;33m\]\`if [[ -e /openils/var/web/ldirectorping.txt ]]; then echo "\\[\\033[32m\\]\[Attached\]\\[\\033[0m\\]"; else echo "\\[\\033[31m\\]\[Detached\]\\[\\033[0m\\]"; fi\`\u@\h:\w\\$ "'>> /root/.bashrc
 echo 'PS1="\[\033[1;33m\]\`if [[ -e /openils/var/web/ldirectorping.txt ]]; then echo "\\[\\033[32m\\]\[Attached\]\\[\\033[0m\\]"; else echo "\\[\\033[31m\\]\[Detached\]\\[\\033[0m\\]"; fi\`\u@\h:\w\\$ "' >> /home/opensrf/.bashrc
 
+### Setup Monitoring
+## Monitored hosts
+if [ -e /etc/nagios/nrpe.cfg ]
+then
+        if [ -e ./.setup_monitoring.sh ]
+        then
+                mkdir -p /etc/nagios
+                ./.setup_monitoring.sh
+        else
+                echo
+                echo "Cannot configure monitoring"
+                echo ".setup_monitoring.sh is missing."
+        fi
+fi
+
 echo
 echo
 echo "Done! This system is now a head"
index 346be41..6adf002 100755 (executable)
@@ -299,23 +299,23 @@ exit 5
 }
 
 if cat /etc/hostname|grep -q db0 #|| cat /etc/hostname|grep -q reporter0
-        then
+then
         if [ -e /etc/sysctl.d ]
-                then
+       then
                echo
                echo "Setting up database server"
                sleep 2
                if [ "$PKG_SET" = "0" ] #setup backports if debian 6.x
-                       then
+               then
                        apt-get update
                        aptitude -t squeeze-backports -yq install postgresql-9.1 postgresql-contrib-9.1 postgresql-plperl-9.1 postgresql-server-dev-9.1 || DBInstallErr
                        elif [ -z "$PKG_SET" ] ; then
                         aptitude -yq install postgresql-9.1 postgresql-contrib-9.1 postgresql-plperl-9.1 postgresql-server-dev-9.1 || DBInstallErr 
-                               else
-                               echo
-                               echo "Failed to set the backports repository for installing Postgresql"
-                               echo "Cannot continue... Exiting"
-                               exit 6
+               else
+                       echo
+                       echo "Failed to set the backports repository for installing Postgresql"
+                       echo "Cannot continue... Exiting"
+                       exit 6
                fi
                 echo "## Evergreen database settings for postgresql" > /etc/sysctl.d/evergreen_db.conf #TODO disabled for now
                #echo "kernel.shmmax=17179869184" >> /etc/sysctl.d/evergreen_db.conf #TODO disabled for now
@@ -520,7 +520,7 @@ then
        a2dissite eg.conf && a2ensite default
        if [ -e /root/eg/eg_sip_root.crontab ]
                 then
-                        crontab -u root ./eg_sip_root.crontab && \
+                        crontab -u root ./root/eg/eg_sip_root.crontab && \
                        echo;echo "SIP Server is configured to restart nightly at midnight."
                 else
                         echo
@@ -581,14 +581,43 @@ then
 fi
 
 ### Setup Basic Monitoring. Nagios/Icinga
+## Monitor server
 if cat /etc/hostname | grep -q "monitor0"
+then   
+       ### Add PPA for lastest Icinga Monitoring Server.
+       if [ -e "/etc/apt/sources.list.d/icinga_ppa.list" ]
+       then
+               if apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36862847
+               then
+                       echo;echo -e $COL_BR_GREEN "Installing latest Icinga for Monitoring"$COL_RESET;echo
+                       apt-get update && apt-get -y install icinga nagios-nrpe-plugin
+               else
+                       echo;echo -e $COL_BR_RED"Could not install signing key."
+                       echo -e "Not installing the monitoring server."
+                       echo -e "You will have to do this manually."$COL_RESET
+               fi
+       else
+               echo 
+               echo -e $COL_BR_RED"Could not install icinga"
+               echo -e "Failed to add icinga PPA"
+               echo -e $COL_RED"/etc/apt/sources.list.d/icinga_ppa.list not found."$COL_RESET
+       fi
+fi
+## Monitored hosts
+if [ -e /etc/nagios/nrpe.cfg ]
 then
-       if add-apt-repository ppa:formorer/icinga
+       if [ -e ./.setup_monitoring.sh ]
        then
-               apt-get update
-               apt-get install icinga
+               mkdir -p /etc/nagios
+               ./.setup_monitoring.sh
+       else
+               echo
+               echo "Cannot configure monitoring"
+               echo ".setup_monitoring.sh is missing."
        fi
 fi
+
+
 ### Enhance bashrc for root.
 cat > bashrc-options.txt << EOF