Add prompts for monitoring admin and Nagios/Icinga notification email address.
authorAndy Witter <awitter@georgialibraries.org>
Fri, 31 May 2013 12:20:45 +0000 (08:20 -0400)
committerAndy Witter <awitter@georgialibraries.org>
Fri, 31 May 2013 12:20:45 +0000 (08:20 -0400)
GenaSYS.sh

index 4028283..7586bd7 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.10"
-       DATE_="2010-09-18; last update: 2013-05-21"
+    VERSION_="1.11"
+       DATE_="2010-09-18; last update: 2013-05-30"
      AUTHOR_="Andy Witter <awitter@georgialibraries.org>"
         URL_="http://evergreen-ils.org"
    CATEGORY_="devel"
@@ -759,6 +759,54 @@ done
 echo
 }
 
+Get_Monitor_Admin_Username () {
+echo
+TitleBar "System Monitoring"
+echo
+echo "In order to configure monitoring for the cluster,"
+echo "(Icinga/Nagios, PhP4Nagios, and Munin) we need to"
+echo "configure the admin credentials and email contact."
+read -p "Enter a monitoring admin username. eg monitoradmin: " MONITOR_ADMIN_USERNAME
+if [ "$MONITOR_ADMIN_USERNAME" = "" ] 
+then
+       MONITOR_ADMIN_USERNAME="monitoradmin"
+       echo
+       echo -e "Setting the monitor admin username to: "$COL_BR_CYAN"monitoradmin"$COL_RESET
+fi
+echo
+}
+
+Get_Monitor_Admin_Password () {
+echo
+TitleBar "Monitoring Admin Password."
+echo
+read -sp "Enter a password for $MONITOR_ADMIN_USERNAME: " MONITOR_ADMIN_PASSWORD
+echo
+read -sp "Confirm password for $MONITOR_ADMIN_USERNAME: " MONITOR_ADMIN_PASSWORD_CONFIRM
+while [[ "$MONITOR_ADMIN_PASSWORD_CONFIRM" == "" || "$MONITOR_ADMIN_PASSWORD" == "" ]]
+        do
+        echo -e $COL_BR_RED"Cannot be blank you must enter a password"$COL_RESET
+        read -sp "Enter the Monitoring Administrator Password: " MONITOR_ADMIN_PASSWORD_CONFIRM
+done
+echo
+}
+
+Get_Notification_Email () {
+echo;echo
+TitleBar "Notification Email Address"
+echo
+echo "A notification email address is necessary in order"
+echo "to recieve alerts from the monitoring servers."
+read -p "Enter notification email address: " NOTIFY_EMAIL_ADDRESS
+while [ "$NOTIFY_EMAIL_ADDRESS" = "" ]
+do
+       echo -e $COL_BR_RED"Cannot be blank you must enter an email address"$COL_RESET
+       read -p "Enter notification email address: " NOTIFY_EMAIL_ADDRESS
+done
+echo 
+echo "Using $NOTIFY_EMAIL_ADDRESS for monitoring alerts"
+}
+
 Confirm_Input () { ### Confirm input. Correct? [y/n]
 while true; do
        read -n 1 -p "Is this correct? [y/n] : " RETRY
@@ -1040,6 +1088,25 @@ then
 fi
 Write_Config_File SYNDETICS_USER_ID
 
+if [ "$MONITOR_ADMIN_USERNAME" = "" ] || [ "$MONITOR_ADMIN_USERNAME" = "0" ]
+then
+       Get_Monitor_Admin_Username
+fi
+Write_Config_File MONITOR_ADMIN_USERNAME
+
+if [ -z $MONITOR_ADMIN_PASSWORD ] || [ "$MONITOR_ADMIN_PASSWORD" == "0" ]
+then
+        Get_Monitor_Admin_Password
+        Confirm_Password '$MONITOR_ADMIN_PASSWORD' '$MONITOR_ADMIN_PASSWORD_CONFIRM' Get_Monitor_Admin_Password
+fi
+Write_Config_File MONITOR_ADMIN_PASSWORD
+
+if [ -z $NOTIFY_EMAIL_ADDRESS ] || [ "$NOTIFY_EMAIL_ADDRESS" == "0" ]
+then
+       Get_Notification_Email
+fi
+Write_Config_File NOTIFY_EMAIL_ADDRESS
+
 #if [ -z $SYNDETICS_USER_ID ] || [ "$SYNDETICS_USER_ID" == "0" ]
 #      then
 #      Get_Syndetics_Userid
@@ -2305,7 +2372,7 @@ echo >> "$NETCFGFILE"
 echo >> "$NETCFGFILE"
 
 
-### Set passwords for nodes that get the debs installed. 
+### Set passwords for nodes that get the OpenSRF and Evergreen debs installed. 
 cp $TEMPLATEDIR/debconf-settings $TMPFOLDER
 sed -i "s^OPENSRF_FQDN^$CLUSTERDOMAINNAME^g" $TMPFOLDER/debconf-settings
 sed -i "s^OPENSRF_USER_PASSWORD^$OPENSRF_PASSWORD^g" $TMPFOLDER/debconf-settings