Example #1
0
def report_usage_to_host(host_ip, vmid):
	
	#base value
	cpu_usage = 0.0
	os_mem_usage = 0.0
	task_mem_usage = 0.0
	io_usage = 0.0

	cpu_usage = get_cpu_usage()
	os_mem_usage = get_os_mem_usage()
	task_mem_usage = get_task_mem_usage()
	io_usage = get_io_usage()

	usage = '\''+str(vmid.strip())+' | '+str(cpu_usage)+' | '+str(os_mem_usage)+' | '+str(task_mem_usage)+' | '+str(io_usage)+'\''
	#usage = "'cpu |sdbfsj |sdfsdhf |sdfvsdvfgdfvj'"
	#cmd = 'python /var/lib/virtdc/vmonere/host/vmonere_listener.py '+usage
	cmd = '/bin/ssh -n -q -o StrictHostKeyChecking=no root@host_ip \"/bin/nohup /bin/python /var/lib/virtdc/vmonere/host/vmonere_listener.py '+usage+' &\"'
	cmd = cmd.replace("host_ip",str(host_ip).strip())

	#cmd_res = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
	os.system(cmd)
def report_usage_to_host(host_ip, vmid):

    #base value
    cpu_usage = 0.0
    os_mem_usage = 0.0
    task_mem_usage = 0.0
    io_usage = 0.0

    cpu_usage = get_cpu_usage()
    os_mem_usage = get_os_mem_usage()
    task_mem_usage = get_task_mem_usage()
    io_usage = get_io_usage()

    usage = str(vmid.strip()) + ' | ' + str(cpu_usage) + ' | ' + str(
        os_mem_usage) + ' | ' + str(task_mem_usage) + ' | ' + str(io_usage)
    #usage = "'cpu |sdbfsj |sdfsdhf |sdfvsdvfgdfvj'"
    #cmd = 'python /var/lib/virtdc/vmonere/host/vmonere_listener.py '+usage
    '''cmd = '/bin/ssh -n -q -o StrictHostKeyChecking=no root@host_ip \"/bin/nohup /bin/python /var/lib/virtdc/vmonere/host/vmonere_listener.py '+usage+' &\"'
	cmd = cmd.replace("host_ip",str(host_ip).strip())'''

    #report usage via socket
    start_client_socket(host_ip, usage)
Example #3
0
def report_usage_to_host(host_ip, vmid):

    #base value
    cpu_usage = 0.0
    os_mem_usage = 0.0
    task_mem_usage = 0.0
    io_usage = 0.0

    cpu_usage = get_cpu_usage()
    os_mem_usage = get_os_mem_usage()
    task_mem_usage = get_task_mem_usage()
    io_usage = get_io_usage()

    usage = '\'' + str(vmid.strip()) + ' | ' + str(cpu_usage) + ' | ' + str(
        os_mem_usage) + ' | ' + str(task_mem_usage) + ' | ' + str(
            io_usage) + '\''
    #usage = "'cpu |sdbfsj |sdfsdhf |sdfvsdvfgdfvj'"
    #cmd = 'python /var/lib/virtdc/vmonere/host/vmonere_listener.py '+usage
    cmd = '/bin/ssh -n -q -o StrictHostKeyChecking=no root@host_ip \"/bin/nohup /bin/python /var/lib/virtdc/vmonere/host/vmonere_listener.py ' + usage + ' &\"'
    cmd = cmd.replace("host_ip", str(host_ip).strip())

    #cmd_res = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
    os.system(cmd)
Example #4
0
def report_usage_to_host(host_ip, vmid):
	
	#base value
	cpu_usage = 0.0
	os_mem_usage = 0.0
	task_mem_usage = 0.0
	io_usage = 0.0

	cpu_usage = get_cpu_usage()
	os_mem_usage = get_os_mem_usage()
	task_mem_usage = get_task_mem_usage()
	io_usage = get_io_usage()

	usage = str(vmid.strip())+' | '+str(cpu_usage)+' | '+str(os_mem_usage)+' | '+str(task_mem_usage)+' | '+str(io_usage)
	#usage = "'cpu |sdbfsj |sdfsdhf |sdfvsdvfgdfvj'"
	#cmd = 'python /var/lib/virtdc/vmonere/host/vmonere_listener.py '+usage
	

	'''cmd = '/bin/ssh -n -q -o StrictHostKeyChecking=no root@host_ip \"/bin/nohup /bin/python /var/lib/virtdc/vmonere/host/vmonere_listener.py '+usage+' &\"'
	cmd = cmd.replace("host_ip",str(host_ip).strip())'''

	#report usage via socket
	start_client_socket(host_ip, usage)