kumistatus/portsopen.py
2016-03-30 18:15:30 +02:00

14 lines
393 B
Python
Executable file

#!/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:
if not porttools.isPortOpen(h[0], h[1]):
time.sleep(retry)
if not porttools.isPortOpen(h[0], h[1]):
two.tweet("@%s Port %s is not open on host %s!" % (h[2], h[1], h[0]))