1

I'm using paramiko for performing esxtop command on my VMware ESXI. To receive the output i try to write the file in a text file . the problem is that i'm not getting the proper output from the script.

Steps performed:

1. Login through ssh_client.

2.`stdin,stdout,stderr = ssh_client.exec_command("TERM=xterm esxtop" , get_pty=True)`    
#TERM=xterm is to set Environment variable to set the proper listing out esxtop command 

3.with open("output.txt", "w") as infile:
        for line in iter(stdout.readline, ""):
            infile.write(line)
# Writing the output to the output.txt file.

The problem is that i'm not getting Complete output and it looks like this error:

125236 125236 esxtop.96492 1 81.97 76.35 0.00 10.56 ^[[K^M

it is not showing output after ^[[K^M.

Can anyone suggest me a solution for this. Thanks in advance. Arshpreet

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • if i'm not using get_pty=True then i'm not getting the output.Output is only possible with get_pty=True. The main problem is in every line its showing limited content i:e upto 125236 125236 esxtop.96492 1 81.97 76.35 0.00 10.56 ^[[K^M . There is more data that should be write but its writing only limited amount of data in every line. – Arshpreet Singh May 09 '18 at 08:49
  • You just cannot get a reasonable information from a pseudo-GUI application. It's not intended for being used this way. – Martin Prikryl May 09 '18 at 09:04

0 Answers0