2016-03-30 16:15:30 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import time, setuptools, porttools, twitools
|
|
|
|
|
|
|
|
hosts = setuptools.getListSetting("Ports", "hosts")
|
|
|
|
retry = int(setuptools.getSetting("Ports", "retry"))
|
|
|
|
two = twitools.twObject()
|
|
|
|
|
|
|
|
for h in hosts:
|
2016-04-28 21:05:40 +00:00
|
|
|
for p in h[1]:
|
|
|
|
if not porttools.isPortOpen(h[0], p):
|
|
|
|
time.sleep(retry)
|
|
|
|
if not porttools.isPortOpen(h[0], p):
|
|
|
|
two.tweet("@%s Port %s is not open on host %s!" % (h[2], p, h[0]))
|