portsopen.py: Take list of ports per host to test
sslexpiry.py: Handle unreachable port
This commit is contained in:
parent
79ac25dd4d
commit
dd9e60fb9a
2 changed files with 15 additions and 11 deletions
|
@ -7,7 +7,8 @@ retry = int(setuptools.getSetting("Ports", "retry"))
|
|||
two = twitools.twObject()
|
||||
|
||||
for h in hosts:
|
||||
if not porttools.isPortOpen(h[0], h[1]):
|
||||
for p in h[1]:
|
||||
if not porttools.isPortOpen(h[0], p):
|
||||
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]))
|
||||
if not porttools.isPortOpen(h[0], p):
|
||||
two.tweet("@%s Port %s is not open on host %s!" % (h[2], p, h[0]))
|
||||
|
|
|
@ -8,6 +8,7 @@ pafter = int(setuptools.getSetting("SSL", "pafter"))
|
|||
two = twitools.twObject()
|
||||
|
||||
for h in hosts:
|
||||
try:
|
||||
expiry = ssltools.getRemoteExpiry(h[0], h[1])
|
||||
diff = expiry - datetime.datetime.now()
|
||||
if diff < datetime.timedelta(days=pbefore):
|
||||
|
@ -15,3 +16,5 @@ for h in hosts:
|
|||
two.tweet("@%s %s certificate expiring soon (%s). Please renew." % (h[2], h[0], expiry))
|
||||
elif expiry + datetime.timedelta(days=pafter) < datetime.datetime.now():
|
||||
two.tweet("@%s %s certificate has expired! (%s) Please renew ASAP!" % (h[2], h[0], expiry))
|
||||
except:
|
||||
two.tweet("@%s Could not verify SSL certificate on %s:%i. Is the server down?" % (h[2], h[0], h[1]))
|
||||
|
|
Loading…
Reference in a new issue