+ values['ping_status'] = True
+
+ try:
+ for port in [22, 806]:
+ ssh = command.SSH('root', nodename, port)
+
+ (oval, errval) = ssh.run_noexcept2(""" <<\EOF
+ echo "{"
+ echo ' "kernel_version":"'`uname -a`'",'
+ echo ' "bmlog":"'`ls /tmp/bm.log`'",'
+ echo ' "bootcd_version":"'`cat /mnt/cdrom/bootme/ID`'",'
+ echo ' "nm_status":"'`ps ax | grep nm.py | grep -v grep`'",'
+ echo ' "fs_status":"'`touch /var/log/monitor 2>&1`'",'
+ echo ' "dns_status":"'`host boot.planet-lab.org 2>&1`'",'
+ echo ' "princeton_comon_dir":"'`ls -d /vservers/princeton_comon`'",'
+
+ ID=`grep princeton_comon /etc/passwd | awk -F : '{if ( $3 > 500 ) { print $3}}'`
+ echo ' "princeton_comon_running":"'`ls -d /proc/virtual/$ID`'",'
+ echo ' "princeton_comon_procs":"'`vps ax | grep $ID | grep -v grep | wc -l`'",'
+ echo "}"
+EOF """)
+
+ values['ssh_error'] = errval
+ if len(oval) > 0:
+ #print "OVAL: %s" % oval
+ values.update(eval(oval))
+ values['ssh_portused'] = port
+ break
+ else:
+ values.update({'kernel_version': "", 'bmlog' : "", 'bootcd_version' : '',
+ 'nm_status' : '',
+ 'fs_status' : '',
+ 'dns_status' : '',
+ 'princeton_comon_dir' : "",
+ 'princeton_comon_running' : "",
+ 'princeton_comon_procs' : "", 'ssh_portused' : None})
+ except:
+ print traceback.print_exc()
+ sys.exit(1)
+
+ ### RUN SSH ######################
+ b_getbootcd_id = True
+ #ssh = command.SSH('root', nodename)
+ #oval = ""
+ #errval = ""
+ #(oval, errval) = ssh.run_noexcept('echo `uname -a ; ls /tmp/bm.log`')
+
+ oval = values['kernel_version']
+ if "2.6.17" in oval or "2.6.2" in oval:
+ values['ssh_status'] = True
+ values['observed_category'] = 'PROD'
+ if "bm.log" in values['bmlog']:
+ values['observed_status'] = 'DEBUG'
+ else:
+ values['observed_status'] = 'BOOT'
+ elif "2.6.12" in oval or "2.6.10" in oval:
+ values['ssh_status'] = True
+ values['observed_category'] = 'OLDPROD'
+ if "bm.log" in values['bmlog']:
+ values['observed_status'] = 'DEBUG'
+ else:
+ values['observed_status'] = 'BOOT'
+
+ # NOTE: on 2.6.8 kernels, with 4.2 bootstrapfs, the chroot command fails. I have no idea why.
+ elif "2.4" in oval or "2.6.8" in oval:
+ b_getbootcd_id = False
+ values['ssh_status'] = True
+ values['observed_category'] = 'OLDBOOTCD'
+ values['observed_status'] = 'DEBUG'
+ elif oval != "":
+ values['ssh_status'] = True
+ values['observed_category'] = 'UNKNOWN'
+ if "bm.log" in values['bmlog']:
+ values['observed_status'] = 'DEBUG'
+ else:
+ values['observed_status'] = 'BOOT'