Commit 79ac25dd authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Add closed port notifier

parent 44fb3f9f
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]):
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]))
import socket
def isPortOpen(host, port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))
return False
return True
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment