Commit 8a7fd21a authored by Dan Reading's avatar Dan Reading
Browse files

demo checkin. scirpts now writeout inventory for testbed database

parent 4c25d77e
......@@ -2,6 +2,7 @@
echo -n ' Cpucheck..'
source checkutils.sh
source getfromtb.sh
declare arch="" failed="" s=""
......@@ -14,14 +15,17 @@ if [ -e "/var/emulab/boot/realname" ]; then
host=`cat /var/emulab/boot/realname`
fi
# setup logging
if [ $1 ] ; then
logfile=$1
else
logfile="/tmp/nodecheck.log"
fi
tmplog=/tmp/.$$.log
cat /dev/null > ${tmplog}
### setup logging
##if [ $1 ] ; then
## logfile=$1
##else
## logfile="/tmp/nodecheck.log"
##fi
##tmplog=/tmp/.$$.log
##cat /dev/null > ${tmplog}
initlogs
#set +x
......@@ -44,7 +48,7 @@ finish() {
exit 0
}
round1p () {
round1p() {
in=$1
y=$(echo "((($in * .005)) + $in)/1" | bc)
......@@ -204,6 +208,12 @@ fi
echo ""
}>> ${tmplog} 2>&1
# if saving data for testbed database
[[ ${x64bit} == 1 ]] && bits=64 || bits=32
if [ -f ${logfile4tb} ] ; then
printf "CPUINFO SOCKET=%s THREADS=%s SPEED=%s BITS=%s HV=%s\n"\
${sockets} ${threads_core} ${mhz} ${bits} ${hyperthread} >> ${logfile4tb}
fi
tbinfo=$(getfromtb cpuinfo $host)
err=$?
......
......@@ -81,13 +81,13 @@ main() {
$temp_val ) d[$temp_val]="unk" ;;
$model ) d[$model]="Model=" ;;
$model_val ) d[$model_val]="unk" ;;
$serial ) d[$serial ]="SN=" ;;
$serial ) d[$serial]="SN=" ;;
$serial_val ) d[$serial_val]="\"UNKNOWN\"" ;;
$bpers ) d[$bpers]="SECSIZE=" ;;
$bpers_val ) d[$bpers_val]="unk" ;;
$sectors ) d[$sectors]="SECTORS=" ;;
$sectors_val ) d[$sectors_val]="\"UNKNOWN\"" ;;
$wspeed ) d[$wspeed ]="WSPEED=" ;;
$wspeed ) d[$wspeed]="WSPEED=" ;;
$wspeed_val ) d[$wspeed_val]="\"UNKNOWN\"" ;;
$rspeed ) d[$rspeed]="RSPEED=" ;;
$rspeed_val ) d[$rspeed_val]="\"UNKNOWN\"" ;;
......@@ -115,7 +115,7 @@ main() {
$driver_val ) d[$driver_val]=$(getdriver ${drive[$idx]}) ;;
$type_val ) d[$type_val]=$(gettype ${drive[$idx]}) ;;
$temp_val ) d[$temp_val]=$(gettemp ${drive[$idx]}) ;;
$model_val ) d[$model_val]=$(getmodel ${drive[$idx]}) ;;
$model_val ) d[$model_val]=$(getmodel ${drive[$idx]}) ;;
$serial_val ) d[$serial_val]=$(getserial ${drive[$idx]}) ;;
# only on first drive only until we have better test
$wspeed_val ) [[ $idx == 0 ]] && d[$wspeed_val]=$(getwspeed ${drive[$idx]}) ;;
......@@ -138,16 +138,17 @@ main() {
esac
done
# just in case
$(rm -f /var/tmp/ddout)
rm -f /var/tmp/ddout
# update driveinv with modified data
driveinv[$idx]=${d[@]}
done
# debug
# echo ""
# echo ""
# for ((idx=0; idx<$numberofdrives; idx++)) ; do
# echo "${driveinv[$idx]}"
#done
# done
# exit
## # does number of drives and size match ?
......@@ -157,30 +158,51 @@ main() {
## tbdata=getfromtb $host driveinfo ${d[$name]}
## done
# if saving data for testbed database
if [ -f ${logfile4tb} ] ; then
printf "%s %d\n" "DISKINFO" ${numberofdrives} >> ${logfile4tb}
for (( idx=0; idx<$numberofdrives; idx++)) ; do
unset -v d ; declare -a d=(${driveinv[$idx]})
printf "%s %s\""%s\"" %s\""%s\"" %s%s %s%s %s%s %s%s\n" \
${d[$header]} \
${d[$serial]} ${d[$serial_val]} \
${d[$type]} ${d[$type_val]} \
${d[$bpers]} ${d[$bpers_val]} \
${d[$sectors]} ${d[$sectors_val]} \
${d[$wspeed]} ${d[$wspeed_val]} \
${d[$rspeed]} ${d[$rspeed_val]} >> ${logfile4tb}
done
fi
#output to log file
{
echo -e "name\tdriver\ttype\tsize\ttemp\tmodel\t\tserial"
for ((idx=0; idx<${#driveinv[*]}; idx++)) ; do
echo -e "name\t\tdriver\ttype\tsize\ttemp\tmodel\t\t\tserial"
for ((idx=0; idx<${numberofdrives}; idx++)) ; do
unset -v d ; declare -a d=(${driveinv[$idx]})
echo -e "${d[$name]}\t${d[$driver]}\t${d[$type]}\t${d[$size]}\t${d[$temp]}\t${d[$model]}\t${d[$serial]}"
echo -e "${d[$name_val]}\t${d[$driver_val]}\t${d[$type_val]}\t${d[$size_val]}\t${d[$temp_val]}\t${d[$model_val]}\t\t${d[$serial_val]}"
done
} > ${tmplog} 2>&1
cat ${tmplog} >> ${logfile}
driveinfo=""
# echo name,size and serial to stdout, addr serialnumber
for ((idx=0; idx<${#driveinv[*]}; idx++)) ; do
unset -v d ; declare -a d=(${driveinv[$idx]})
echo -n "${d[$name]} ${d[$size]} ${d[$serial]} "
echo -n "${d[$name_val]} ${d[$size_val]} ${d[$serial_val]} "
driveinfo+="${d[$serial]} "
done
echo "" ; exit
driveinfo=${driveinfo% } # get rid of trailing space
# Now check against the testbed DB
tbinfo=$(getfromtb diskinfo $host)
echo tbinfo:|"$tbinfo"|
exit
error=$?
# echo drivesize:$drivesize: tbinfo:$tbinfo: error:$error
......@@ -393,6 +415,10 @@ getmodel() {
res=$($smtcl -a $1 | grep 'Product:')
res=${res/Product: }
fi
# remove leading spaces
res=${res##* }
# no internal spaces
res=${res// /-}
[[ $res ]] && echo "$res" || echo "UNKNOWN"
return 0
}
......@@ -527,6 +553,7 @@ parsedd() {
}
main $@
#cleanup
exit 0
......
......@@ -8,6 +8,7 @@ _32KGiB=33554432
echo -n ' Starting memcheck..'
source checkutils.sh
source getfromtb.sh
source hbis.sh
......@@ -20,14 +21,16 @@ if [ -e "/var/emulab/boot/realname" ]; then
fi
# setup logging
if [ $1 ] ; then
logfile=$1
else
logfile="/tmp/nodecheck.log"
fi
tmplog=/tmp/.$$.log
cat /dev/null > ${tmplog}
## # setup logging
##if [ $1 ] ; then
## logfile=$1
## else
## logfile="/tmp/nodecheck.log"
## fi
## tmplog=/tmp/.$$.log
## cat /dev/null > ${tmplog}
initlogs
#set +x
#exit on unbound var
......@@ -112,6 +115,18 @@ esac
echo -n "Found phys memory $meminfo"
} >> ${tmplog} 2>&1
# if saving data for testbed database
num=${meminfo//[a-z]*/}
num=${meminfo//[A-Z]*/}
base=${meminfo//[0-9]/}
#it is MiB or GiB
if [ "$base" == "GiB" ] ; then
num=$(($num * 1024))
fi
if [ -f ${logfile4tb} ] ; then
printf "MEMINFO SIZE=%s\n" ${num} >> ${logfile4tb}
fi
tbinfo=$(getfromtb meminfo $host)
{
......
......@@ -2,6 +2,7 @@
echo -n ' Starting niccheck.. '
source checkutils.sh
source getfromtb.sh
os=`uname`
......@@ -12,15 +13,17 @@ if [ -e "/var/emulab/boot/realname" ]; then
fi
# setup logging
if [ $1 ] ; then
logfile=$1
else
logfile="/tmp/nodecheck.log"
fi
tmplog=/tmp/.$$.log
initlogs
## # setup logging
## if [ $1 ] ; then
## logfile=$1
## else
## logfile="/tmp/nodecheck.log"
## fi
##tmplog=/tmp/.$$.log
##cat /dev/null > ${tmplog}
tmplog2=/tmp/.2tmp
cat /dev/null > ${tmplog}
finished() {
cat ${tmplog2}
......@@ -81,6 +84,15 @@ tbcnt=${#tbinfo[*]}
numnics=$ifcnt
maxcnt=${ifcnt}
# if saving data for testbed database
if [ -f ${logfile4tb} ] ; then
printf "NETINFO UNITS=%s\n" ${ifcnt} >> ${logfile4tb}
for ((ifi=0; ifi<$ifcnt; ifi++)) ; do
printf "NETUNIT TYPE=\""ETH\"" ID=\""%s\""\n" ${ifinfo[$ifi]} >> ${logfile4tb}
done
fi
if [[ ${ifcnt} -ne ${tbcnt} ]] ; then
failed="TBmiss"
[[ ${ifcnt} -gt ${tbcnt} ]] && maxcnt=${ifcnt} || maxcnt=${tbcnt}
......
......@@ -41,7 +41,7 @@ $host = `hostname`;
if ( -r '/var/emulab/boot/realname' ) {
$host = `cat /var/emulab/boot/realname`;
}
print "from startup host:$host\n";
if (!$ARGV[0]) {
$action = "noboot";
} else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment