Add munin config to Monitoring servers.
authorAndy Witter <awitter@georgialibraries.org>
Mon, 21 Oct 2013 12:20:29 +0000 (08:20 -0400)
committerAndy Witter <awitter@georgialibraries.org>
Mon, 21 Oct 2013 12:20:29 +0000 (08:20 -0400)
GenaSYS.sh

index 4edc6e8..6369735 100755 (executable)
@@ -69,6 +69,7 @@ TMPREVZONEFILE="${TMPFOLDER}/tmprevzonefile.txt"
 TMPOSRFNODES="${TMPFOLDER}/tmposrfnodes"
 TMPOPENSRF_XML="${TMPFOLDER}/tmpopensrf.xml"
 TMPNAGIHOSTS="${TMPFOLDER}/hosts.cfg"
+TMPMUNINCONF="${TMPFOLDER}/munin.conf"
 PSQL_VERSION="9.1"
 [ -z $CONFIG_FILE ] && CONFIG_FILE="$WD/genasys.conf"
 NEW_CONFIG_FILE="$OUTDIR/genasys.conf"
@@ -2321,7 +2322,7 @@ do
        MUNIN_HOST=$( echo "${MUNINODE}" | tr  '[:lower:]'  '[:upper:]' )
        MUNIN_CFG_FILE="${OUTDIR}/${MUNINODE}/etc/munin/munin-node.conf"
        mkdir -p "${OUTDIR}/${MUNINODE}/etc/munin"
-        echo '### Generated by GenaSYS' >> ${MUNIN_CFG_FILE}
+        echo "### Generated by GenaSYS $_VERSION for Evergreen $EG_VER" >> ${MUNIN_CFG_FILE}
        echo "host_name ${MUNINODE}.${CLUSTERDOMAINNAME}" >> ${MUNIN_CFG_FILE}
        printf "allow $MONITOR01_IP   # IP address of the monitor server\n" >> ${MUNIN_CFG_FILE}
        printf "allow $MONITOR02_IP   # IP address of the monitor server\n" >> ${MUNIN_CFG_FILE}
@@ -2332,10 +2333,26 @@ do
                eval echo -e "host \$${MUNIN_HOST#*-}_IP    \# Host IP address" >> ${MUNIN_CFG_FILE} 
        fi
 done
-## Munin on monitor servers
-for MUNINODE in ${MACHINES_MONITOR}
+## Build munin.conf for monitor servers.
+for MUNINODE in ${MACHINES_NO_BRICKS}
+do
+       MUNIN_HOST=$( echo "${MUNINODE}" | tr  '[:lower:]'  '[:upper:]' )
+       echo "[${MUNINODE}.${CLUSTERDOMAINNAME}]" >> $TMPMUNINCONF
+       if echo $MUNINODE | grep -q lvs0
+       then   
+               eval echo -e "\\\taddress \$${MUNIN_HOST#*-}_PRIVATE_IP" >> $TMPMUNINCONF
+       else   
+               eval echo -e "\\\taddress \$${MUNIN_HOST#*-}_IP" >> $TMPMUNINCONF
+       fi
+       echo -e "\tuse_node_name yes" >> $TMPMUNINCONF
+       echo >> $TMPMUNINCONF
+done
+
+## copy munin.conf to monitor servers.
+for MONITOR in ${MACHINES_MONITOR}
 do
-       echo $MMACHINES_MONITOR
+       mkdir -p "$OUTDIR/$MONITOR/etc/munin"
+       cp -f "$TMPMUNINCONF" "$OUTDIR/$MONITOR/etc/munin"
 done