<lbaconfig> <!-- This is a sample configuration file! see LoadBalancer_en.odt for more information --> <lbaservice listen="*:8000"/> <specs> <!-- Return IP addresse as defined in the first line of hostname command --> <constant name="IP"> <command>hostname -i | tail -1</command> </constant> <!-- Return hostname --> <constant name="HOSTNAME"> <command>hostname</command> </constant> <!-- Return all addresse from the hostname command --> <constant name="ADDRESSES"> <command>hostname -i</command> </constant> <!-- Return the memory total (kb) --> <constant name="MEMTOTAL"> <command>cat /proc/meminfo | grep MemTotal | tr -s " " "," | cut -d"," -f2</command> </constant> <!-- Return the cpu frequency (mhz) --> <constant name="CPUFREQ"> <command>cat /proc/cpuinfo | grep "cpu MHz" | tail -1 | cut -d":" -f2</command> </constant> <!-- Return the number of cpu --> <constant name="CPUCOUNT"> <command> VAL=`cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l` ; if [ -z $VAL -o "$VAL"=="0" ] ; then echo "1" ; else echo $VAL fi ; </command> </constant> <!-- Return the cpu constructor --> <constant name="CPUVENDOR"> <command>cat /proc/cpuinfo | grep "vendor_id" | tail -1 | cut -d":" -f2</command> </constant> <!-- Return the os distribution --> <constant name="DISTRO"> <command> for X in redhat SuSE mandrake debian knoppix fedora mandriva ; do if [ -f /etc/$X-release ]; then cat /etc/$X-release ; break ; fi ; done ; </command> </constant> </specs> <status> <!-- Return the free memory (kb)--> <variable name="MEMFREE" refresh-delay="30"> <command>free | grep buffers\/cache: | awk {'print $4'}</command> </variable> <!-- Return the used memory (kb)--> <variable name="MEMUSED" refresh-delay="30"> <eval>$MEMTOTAL-$MEMFREE</eval> </variable> <!-- % load of the processor --> <variable name="LOADAVG" refresh-delay="60"> <command>cat /proc/loadavg |cut -d" " -f1</command> </variable> <!-- Return the number of opened X11 session --> <variable name="NBX11SESS" refresh-delay="30"> <command>netstat -t | grep x11 | tr -s " " "," | cut -d"," -f4 | cut -d":" -f1 -s | sort | uniq | wc -l</command> </variable> <!-- Return the list of active users --> <variable name="USERS" refresh-delay="10"> <command>who -u | cut -d" " -f1 | sort | uniq</command> </variable> </status> </lbaconfig>