Guest User

Untitled

a guest
Nov 23rd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import os
  2.  
  3. # Read IP's from a list
  4. IP_ADDR = ['192.168.1.201', '192.168.1.202', '192.168.1.203', '192.168.1.204', '192.168.1.205', '192.168.1.207', '192.168.1.208', '192.168.1.209', '192.168.1.210', '192.168.1.211', '192.168.1.212', '192.168.1.213', '192.168.1.214', '192.168.1.215']
  5.  
  6. # Blank list, use append to add to list
  7. IP_STATE = []
  8.  
  9. username = os.getlogin()
  10.  
  11. print "\nWelcome " + username
  12.  
  13. # os.system ping return codes: 256 is failed, 2 is cancled, 0 is successful
  14. # ping the servers.
  15. for iii in range(0,16):
  16. if os.system("ping " + IP_ADDR[iii] + " -c 1 -w 1") == 0:
  17. # add the IP state to the IP_STATE list
  18. IP_STATE.append("Up")
  19. else:
  20. # Add the IP state to the IP_STATE list
  21. IP_STATE.append("Down?")
  22.  
  23. iii = 0
  24. # Show information
  25. for iii in range(0,16):
  26. print IP_OWNER[iii] + " - " + IP_ADDR[iii] + " - " + IP_STATE[iii]
Add Comment
Please, Sign In to add comment