I'm trying to get ps -aux command output for multiple servers in a excel or csv format. Output needs to be printed for the servers in different sheets. I'm unable to do that. Can someone help me on this by completing this script.
import paramiko
import subprocess
import json
import csv
with open(r'filepath\serverlist.json') as f:
data=json.load(f)
client = paramiko.SSHClient()
target_host = txt
un = 'root'
pwd = 'xxx'
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=target_host,username=un,password=pwd)
stdin, stdout, stderr = client.exec_command('ps -aux')
Expected output as below for a server and it requires to be saved in different sheet for each server.
