Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pprint import pprint
- from pssh.pssh_client import ParallelSSHClient
- from pssh.pssh_client import ParallelSSHClient
- from pssh.exceptions import AuthenticationException, \
- UnknownHostException, ConnectionErrorException
- def telemetryServer(customCommand):
- config = {
- "hosts" : ['10.4.114.208', '10.4.115.111'],
- "user" : "karan_sharma1",
- "pass" : "karan"
- }
- mainServer(config,customCommand)
- def rabbitmqServer(customCommand):
- config = {
- "hosts" : ['10.125.148.34', '10.125.148.35', '10.125.148.25'],
- "user" : "karan_sharma1",
- "pass" : "*************"
- }
- mainServer(config,customCommand)
- def mainServer(config,customCommand):
- telemetryClient = ParallelSSHClient(config["hosts"],user=config["user"],password=config["pass"])
- try:
- output = telemetryClient.run_command(customCommand)
- except (AuthenticationException, UnknownHostException, ConnectionErrorException):
- pass
- for host in output:
- print(" ")
- print(host)
- print("-------------------------")
- for line in output[host].stdout:
- print(line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement