IP monitor using python

2015-07-18 23:00:00
Views: 2947

Simple script that executes a ping for all hosts in the array.

import os


hosts = ["127.0.0.1","127.0.0.1","2.2.2.2"]

for host in hosts:
    response = os.system("ping -c 1 " + host);
    print "--------";
    print "ping: ";
    print host;
    print "got: ";
    print response;
    print "status: ";
    if response == 0:
        print "host is up";
    else:
        print "host is down";
    #print "trying" + host + "got" + response


why-guy add:

Last Tweets: