Add SKS keyserver monitor
This commit is contained in:
parent
af06c5af6f
commit
f09cb30772
12
skstools/__init__.py
Normal file
12
skstools/__init__.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
import urllib.request, urllib.error
|
||||
|
||||
def getStatus(server):
|
||||
try:
|
||||
source = str(urllib.request.urlopen("https://sks-keyservers.net/status/ks-status.php?server=%s" % server).read())
|
||||
if "No data found for keyserver" in source:
|
||||
return False
|
||||
if "Reason" in source:
|
||||
return False
|
||||
return True
|
||||
except urllib.error.URLError:
|
||||
return None
|
12
sksup.py
Executable file
12
sksup.py
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import time, setuptools, skstools, twitools
|
||||
|
||||
def check(server, recipient, two = twitools.twObject()):
|
||||
if skstools.getStatus(server) == False:
|
||||
two.tweet("@%s Something seems to be wrong with the %s keyserver!" % (recipient, site))
|
||||
|
||||
if __name__ == "__main__":
|
||||
servers = setuptools.getListSetting("SKS", "servers")
|
||||
for s in servers:
|
||||
check(s[0], s[1])
|
Loading…
Reference in a new issue