Esempio n. 1
0
 host_ip_list = sp_define.get_all_host_ip()
 result_dict = {}
 for host_ip in host_ip_list:
     if not host_ip in sp_define.HOST_LIST: continue
     print "\n"
     print '='*30 + host_ip + '='*30
     host_ip_suffix = Util.get_ip_field(host_ip, 3)
     #cmd = 'grep -i error /mnt/' + host_ip_suffix + '/*.log | ' + sp_define.PATTERN_EXCLUSIVE_IN_MEDUSA
     #cmd = 'grep -i "' + ERROR_PATTERN + '" /mnt/' + host_ip_suffix + '/medusa/*.log'
     cmd = 'grep -i error /root/tools/medusa/shell-sdb/*.log ' + sp_define.PATTERN_EXCLUSIVE_IN_MEDUSA
     #print cmd
     try:
         node = NodeCompute(host_ip)
         node.run_cmd(cmd)
         ssh = node.get_ssh()
         shell_status = Util.check_shell_status(ssh)
         if shell_status:
             print '-'*80 + '>>> found pattern: ' + ERROR_PATTERN
             #subprocess.call(['python', 'medusa_stop.py'])
             #subprocess.call(['python', 'get_uptime.py'])
             #subprocess.call(['sh', 'get_var_log_msg_all.sh'])
             #subprocess.call(['sh', 'get_medusa_log_all.sh'])
             #subprocess.call(['python', '../nj/cruz_collect_tech.py'])
             #subprocess.call(['python', '../ucsm/system/collect_tech_support.py'])
             #sys.exit()
         else:
             print "found no pattern"
         node.exit()
         result_dict[host_ip] = True
     except (KeyboardInterrupt, AttributeError, pexpect.TIMEOUT):
         print "ERROR: Timeout"
Esempio n. 2
0
 def start_pingpong_client(self, usnic, ip_address):
     self._ssh.send_expect_prompt("ibv_ud_pingpong -g 0 -s 100 -d " + usnic + " " + ip_address)
     return Util.check_shell_status(self._ssh)
Esempio n. 3
0
from lib.node_head import NodeHead
from lib.util import Util

ERROR_PATTERN = 'Data corruption detected'
#ERROR_PATTERN = 'kasdjflasjdlasjfd'

if __name__ == '__main__':
    
    head_node = NodeHead(Define.NODE_HEAD_NAME, Define.NODE_USERNAME_ROOT, Define.NODE_DEFAULT_PASSWORD)

    cmd = 'grep -i "' + ERROR_PATTERN + '" /home/export/1*/medusa/*.log'
    print cmd
    
    while True:
        head_node.run_cmd(cmd)
        shell_status = Util.check_shell_status(head_node.get_ssh())
        if shell_status:
            print '-'*30 + '>>> found pattern: ' + ERROR_PATTERN
            subprocess.call(['python', 'medusa_stop.py'])
            subprocess.call(['python', 'get_uptime.py'])
            #subprocess.call(['python', '../nj/cruz_collect_tech.py'])
            #subprocess.call(['python', '../ucsm/system/collect_tech_support.py'])
            head_node.exit()
            sys.exit()
        else:
            print "found no pattern"
        time.sleep(60)
        
        
    
    
Esempio n. 4
0
 def start_pingpong_server(self, usnic):
     self._ssh.send_expect_prompt("ibv_ud_pingpong -g 0 -s 100 -d " + usnic)
     return Util.check_shell_status(self._ssh)