핑 체크 프로그램
-
[Python] linux ping check(ICMP) programPython/Python for Linux 2019. 4. 9. 13:40
#!/usr/bin/python # Python Version : 2.7.5 from os import system from datetime import datetime checkList = ('127.0.0.1','192.168.x.99','192.168.x.98') logTime = str(datetime.today())[:19] for host in checkList: cmdstring = 'ping -c1 '+host+' 1>/dev/null' # Linux Ping Check Command var = system(cmdstring) if var == 0: # value = 0, OK print host, 'ping ok : ', logTime else: print host, 'ping fail ..