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"
}
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
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
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