Update monitor admin credentials for icinga/nagios
authorAndy Witter <awitter@georgialibraries.org>
Fri, 25 Oct 2013 03:48:49 +0000 (23:48 -0400)
committerAndy Witter <awitter@georgialibraries.org>
Fri, 25 Oct 2013 03:48:49 +0000 (23:48 -0400)
GenaSYS.sh
templates/icinga.debconf [new file with mode: 0755]
templates/setup.sh

index ecf49e8..c3326bb 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.16"
-       DATE_="2010-09-23; last update: 2013-10-23"
+    VERSION_="1.17"
+       DATE_="2010-09-23; last update: 2013-10-24"
      AUTHOR_="Andy Witter <awitter@georgialibraries.org>"
         URL_="http://evergreen-ils.org"
    CATEGORY_="devel"
@@ -779,9 +779,13 @@ Get_Monitor_Admin_Password () {
 echo
 TitleBar "Monitoring Admin Password."
 echo
-read -sp "Enter a password for $MONITOR_ADMIN_USERNAME: " MONITOR_ADMIN_PASSWORD
+echo "In order to configure monitoring for the cluster,"
+echo "we need to configure the admin credentials"
+echo "(icingaadmin, and muninadmin)"
+echo
+read -sp "Enter a password for (icingaadmin and muninadmin): " MONITOR_ADMIN_PASSWORD
 echo
-read -sp "Confirm password for $MONITOR_ADMIN_USERNAME: " MONITOR_ADMIN_PASSWORD_CONFIRM
+read -sp "Confirm password for (icingaadmin and muninadmin): " 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
@@ -1087,11 +1091,11 @@ 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 [ "$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
@@ -1100,11 +1104,11 @@ then
 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 $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
@@ -2333,7 +2337,7 @@ for NAGINODE in ${MACHINES_MONITOR}
 do
        MONITOR_SERVER=$( echo "${NAGINODE}" | tr  '[:lower:]'  '[:upper:]' )
        ### remove prefix ${MONITOR_SERVER#*-}
-       echo ${MACHINES_MONITOR#*-}
+       #echo ${MACHINES_MONITOR#*-}
        THIS_MONITOR_SERVER_IP=$(eval echo \$${MONITOR_SERVER#*-}_IP) ## strip prefix
        if [ -z "$MONITOR_SERVER_IP_LIST" ]
        then
@@ -2395,7 +2399,6 @@ do
        cp -f "$TMPMUNINCONF" "$OUTDIR/$MONITOR/etc/munin"
 done
 
-echo all machines: $ALL_MACHINES_LIST
 
 ### Write config info file.
 echo >> "$NETCFGFILE"
@@ -2690,6 +2693,8 @@ then
        cp -f "${TMPFOLDER}/icinga_ppa.list" "setup_${NODE_FOLDER}/Icinga-Nagios"
        cp -f "$TEMPLATEDIR/monitor/extinfo_icinga.cfg" "setup_${NODE_FOLDER}/Icinga-Nagios"
        cp -f "$TEMPLATEDIR/monitor/munin-cron.crontab" "setup_${NODE_FOLDER}/Munin" 
+       cp -f "$TEMPLATEDIR/icinga.debconf" "setup_${NODE_FOLDER}/.icinga.debconf"
+       sed -i "s^MONITOR_PW^${MONITOR_ADMIN_PASSWORD}^g" "setup_${NODE_FOLDER}/.icinga.debconf"
 fi
 sed -i "s^tar_file^$NODE_FOLDER^g" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh"
 sed -i "s^_EGVER^$EG_VERSION^g" "setup_${NODE_FOLDER}/setup_$NODE_FOLDER.sh"
diff --git a/templates/icinga.debconf b/templates/icinga.debconf
new file mode 100755 (executable)
index 0000000..4189c2f
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/debconf-set-selections
+
+icinga-common icinga/check_external_commands boolean true
+icinga-cgi icinga/adminpassword password MONITOR_PW
+icinga-cgi icinga/adminpassword-repeat password MONITOR_PW
+
+### should not need this if icinga is installed but..
+nagios3-cgi nagios3/adminpassword password MONITOR_PW
+nagios3-cgi nagios3/adminpassword-repeat password MONITOR_PW
index c3be4fd..083d6e8 100755 (executable)
@@ -174,6 +174,12 @@ then
         "$WD/postfix.debconf"
 fi
 
+### If this is a monitor server preload debconf
+if [ -e "$WD/.icinga.debconf" ]
+then
+       "$WD/.icinga.debconf"
+fi
+
 ### Install dependencies
 if [ -e tar_file_apt.list ]
        then