Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- # Read IP's from a list
- 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']
- # Blank list, use append to add to list
- IP_STATE = []
- username = os.getlogin()
- print "\nWelcome " + username
- # os.system ping return codes: 256 is failed, 2 is cancled, 0 is successful
- # ping the servers.
- for iii in range(0,16):
- if os.system("ping " + IP_ADDR[iii] + " -c 1 -w 1") == 0:
- # add the IP state to the IP_STATE list
- IP_STATE.append("Up")
- else:
- # Add the IP state to the IP_STATE list
- IP_STATE.append("Down?")
- iii = 0
- # Show information
- for iii in range(0,16):
- print IP_OWNER[iii] + " - " + IP_ADDR[iii] + " - " + IP_STATE[iii]
Add Comment
Please, Sign In to add comment