Make sure we can contact the signer.
This commit is contained in:
Родитель
7e967deaeb
Коммит
c042a7926c
|
@ -3,6 +3,7 @@ from PIL import Image
|
|||
import socket
|
||||
import StringIO
|
||||
import traceback
|
||||
import urllib2
|
||||
from urlparse import urlparse
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -178,3 +179,19 @@ def hera():
|
|||
status = False
|
||||
|
||||
return status, hera_results
|
||||
|
||||
|
||||
def signer():
|
||||
destination = getattr(settings, 'SIGNING_SERVER', None)
|
||||
if not destination:
|
||||
return True, "Signer is not configured."
|
||||
|
||||
destination += "/1.0/sign"
|
||||
request = urllib2.Request(destination)
|
||||
try:
|
||||
urllib2.urlopen(request)
|
||||
except urllib2.HTTPError, error:
|
||||
if error.code == 405:
|
||||
return True, "%s is working." % destination
|
||||
|
||||
return False, "%s can not be contacted." % destination
|
||||
|
|
|
@ -118,4 +118,11 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="notification-box {{ status(status_summary.signer) }}">
|
||||
<h2>[Signer] Connection Test (signer) ({{ signer_timer }}ms)</h2>
|
||||
<ul>
|
||||
<li>{{ signer_results }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{% endblock main_content %}
|
||||
|
|
|
@ -42,7 +42,7 @@ def monitor(request, format=None):
|
|||
status_summary = {}
|
||||
results = {}
|
||||
|
||||
checks = ['memcache', 'libraries', 'elastic', 'path', 'redis', 'hera']
|
||||
checks = ['memcache', 'libraries', 'elastic', 'path', 'redis', 'hera', 'signer']
|
||||
|
||||
for check in checks:
|
||||
with statsd.timer('monitor.%s' % check) as timer:
|
||||
|
|
Загрузка…
Ссылка в новой задаче