Hello ,
I have a code that read data from DB and return a list of IP (around 600 every query )
now I wrote a code that check if the device is online
but he check one by one , and it's about 4 second each so
600 can take ~ 2400 seconds ~ 40 min .....
is there any way to make him run 10 pings every check?
so it will take only ~ 4 min to check them all?
this is what I have now that is working :
Thanks ,
I have a code that read data from DB and return a list of IP (around 600 every query )
now I wrote a code that check if the device is online
but he check one by one , and it's about 4 second each so
600 can take ~ 2400 seconds ~ 40 min .....
is there any way to make him run 10 pings every check?
so it will take only ~ 4 min to check them all?
this is what I have now that is working :
def CheckOnLine(hostname): DeviceTTl = Getttl(hostname) if 200 > DeviceTTl > 0: print(hostname, " TTL - ", DeviceTTl, ' is up!') time.sleep(2) return True elif DeviceTTl == 250: print(hostname + " problem in Device 250") return False else: print(hostname, ' OFFLINE!') return False def Getttl(ip): try: result = os.popen("ping -n 1 " + ip).read() except Exception as e: print(e) return -1 else: n = result.find("TTL=") if n > 0: ttl = result[n + 4:] print(ttl) n = ttl.find("\n") if n > 0: print(ttl[:n]) return int(ttl[:n]) return -1what I need to add?
Thanks ,