Advertisement
Guest User

Untitled

a guest
Mar 21st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. from pprint import pprint
  2. from pssh.pssh_client import ParallelSSHClient
  3.  
  4.  
  5. from pssh.pssh_client import ParallelSSHClient
  6. from pssh.exceptions import AuthenticationException, \
  7. UnknownHostException, ConnectionErrorException
  8.  
  9. def telemetryServer(customCommand):
  10. config = {
  11. "hosts" : ['10.4.114.208', '10.4.115.111'],
  12. "user" : "karan_sharma1",
  13. "pass" : "karan"
  14. }
  15. mainServer(config,customCommand)
  16.  
  17. def rabbitmqServer(customCommand):
  18. config = {
  19. "hosts" : ['10.125.148.34', '10.125.148.35', '10.125.148.25'],
  20. "user" : "karan_sharma1",
  21. "pass" : "*************"
  22. }
  23. mainServer(config,customCommand)
  24.  
  25. def mainServer(config,customCommand):
  26. telemetryClient = ParallelSSHClient(config["hosts"],user=config["user"],password=config["pass"])
  27.  
  28. try:
  29. output = telemetryClient.run_command(customCommand)
  30. except (AuthenticationException, UnknownHostException, ConnectionErrorException):
  31. pass
  32.  
  33. for host in output:
  34. print(" ")
  35. print(host)
  36. print("-------------------------")
  37. for line in output[host].stdout:
  38. print(line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement