Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #!/usr/bin/python
  2. import paramiko
  3. import os,sys
  4.  
  5. sys.stderr = open('/dev/null') # Silence silly warnings from paramiko
  6. sys.stderr = sys.__stderr__
  7.  
  8. pm = paramiko.SSHClient()
  9. pm.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  10. pm.connect('test-cls-mgt',
  11. username='admin',
  12. password='admin')
  13.  
  14.  
  15. cmd1 = ['vol show']
  16. cmd2 = ['quota show -vserver noitest_vs0 -volume ansibleVolume']
  17. cmd3 = ['network interface show']
  18.  
  19. cmd = [ cmd1, cmd2, cmd3 ]
  20.  
  21. def run_command(command):
  22. stdin,stdout,stderr = pm.exec_command(command)
  23.  
  24. print('*** ' + command + ' ***')
  25. print('')
  26.  
  27. for line in iter(stdout.readline, ''):
  28. print line.rstrip()
  29.  
  30. print('')
  31.  
  32. for commands in cmd:
  33. run_command(commands)
  34.  
  35. pm.close()
  36.  
  37. bash-4.1$ ./testing_ONTAP2.py
  38. *** vol show ***
  39.  
  40. Vserver Volume Aggregate State Type Size Available Used%
  41. --------- ------------ ------------ ---------- ---- ---------- ---------- -----
  42.  
  43. vs0 TestVolume01 aggr1 online RW 500MB 474.7MB 5%
  44. vs0 ansibleVolume aggr1 online RW 20MB 18.81MB 5%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement