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"
+ echo "$MONITOR_ADMIN_PASSWORD" > "setup_${NODE_FOLDER}/.munin_admin_password"
+ chmod 700 "setup_${NODE_FOLDER}/.munin_admin_password"
+ chmod 700 "setup_${NODE_FOLDER}/.munin_admin_password"
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"
a2ensite munin-vhost.conf
fi
+## Setup htpasswd for Munin.
+if [ -e ${WD}/.munin_admin_password ]
+then
+ MUNIN_PWD="$(cat ${WD}/.munin_admin_password)"
+ echo
+ echo "Generating password for muninadmin ..."
+ sleep 2
+ htpasswd -bc /var/cache/munin/www muninadmin ${MUNIN_PWD} && rm -f ${WD}/.munin_admin_password
+fi
+
## Setup Apache2 for Icinga
if [ -e /etc/apache2/sites-available/icinga-vhost.conf ]
then