DistCC Monitor [Distributive Cross Compilation Monitor]
21 Feb 2012DistCC is a distributive cross compilation tool-kit which can be used to distribute the process of compilation across multiple hosts. It will help faster the build by distributing the build process to multiple host computers on the network.
It can be used as part of tool chain by just configuring the CC parameter in the Makefile. For distCC to work distCC should be installed on all the system and distCC-deamon should be instanciated on all the systems.
More information regarding distcc can be found here [ distCC Homepage ]
DistCC Monitor is a small script file used to monitor the health of distCC server hosts. It performs distCC analysis on the host computers and sends email about their health status.
#!/bin/bash | |
# Aayush Tuladhar | |
# v1.0 (2011) | |
# DistCC Monitor | |
# Performs Distcc On the Host Servers. Gets the compilation time and delivers email using sendmail. | |
HOSTFILE=/usr/local/itasca/buildtools/etc/lsdistcc_hosts | |
sendmailbin=/usr/sbin/sendmail | |
WORKING_DIR=`pwd` | |
MAIL_LIST_FILENAME=maillist.txt | |
REPORTFILENAME=$(date +"%b_%e_%Y"_report.txt) | |
REPORTFILE=$WORKING_DIR/$REPORTFILENAME | |
MAIL_LIST=$WORKING_DIR/$MAIL_LIST_FILENAME | |
SERVER_STATUS=0 #0 - No Server Down #1 - Server Down | |
#Mail Settings (FROM, SUBJECT, emailtarget, msgdate, daemail) | |
FROM="distcc_report.mailbot@distccmon.com" | |
function sendmail(){ | |
if [ -z $SERVER_STATUS ] | |
then | |
SUBJECT="Buildfarm Monitor : Server Up" | |
else | |
SUBJECT="Buildfarm Monitor : Server Down" | |
fi | |
msgdate='date+"%a, %e %Y %T %z"' | |
daemail=$(cat <> $REPORTFILE | |
SERVER_STATUS=1 | |
else | |
echo "Server : $1 [UP]" >> $REPORTFILE | |
fi | |
} | |
echo "$(date)" >> $REPORTFILE | |
echo "-------------------------------------" >> $REPORTFILE | |
if [ -r $HOSTFILE ] | |
then | |
#Reading Hosts | |
exec 9<$HOSTFILE | |
while read -u9 line | |
do | |
#Processing Hosts | |
check_status $line | |
done | |
else | |
echo "Error : HostFile ($HOSTFILE) not Found" | |
exit 111 #Exit 111 : Hostfile Not Found | |
fi | |
#Reading Maillist | |
if [ -r $MAIL_LIST ] | |
then | |
#Reading Maillist | |
exec 8<$MAIL_LIST | |
while read -u8 list | |
do | |
#Reading List | |
emailtarget=$list,$emailtarget | |
done | |
echo -e "\nSTATUS : Sending Mail to $emailtarget" | |
sendmail | |
else | |
echo "Error : Maillist ($MAIL_LIST) not Found" | |
exit 112 #Exit 112 : Maillist Not Found | |
fi |