Add PIL+JPEG to monitor. /me sees a code refresh coming to this script soon
This commit is contained in:
Родитель
2446562dae
Коммит
779a9cef0f
|
@ -25,6 +25,21 @@
|
|||
<p>There must be a minimum of 2 working servers.</p>
|
||||
</div>
|
||||
|
||||
<div class="notification-box {{ status(status_summary.libraries) }}">
|
||||
<h2>[libs] Libraries and Versions</h2>
|
||||
<dl>
|
||||
{% for lib, result, msg in libraries_results %}
|
||||
<dt>{{ lib }}</dt>
|
||||
<dd>
|
||||
{% if success %}
|
||||
{{ msg }}
|
||||
{% else %}
|
||||
<strong>{{ msg }}</strong>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
</div>
|
||||
<div class="notification-box {{ status(status_summary.filepaths) }}">
|
||||
<h2>[Paths] Paths and Permissions</h2>
|
||||
<dl>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import os
|
||||
import random
|
||||
from PIL import Image
|
||||
import socket
|
||||
import StringIO
|
||||
import urllib2
|
||||
from urlparse import urlparse
|
||||
|
||||
|
@ -68,6 +70,17 @@ def monitor(request):
|
|||
status_summary['memcache'] = False
|
||||
log.info('Memcache is not configured.')
|
||||
|
||||
# Check Libraries and versions
|
||||
libraries_results = []
|
||||
status_summary['libraries'] = True
|
||||
try:
|
||||
Image.new('RGB', (16, 16)).save(StringIO.StringIO(), 'JPEG')
|
||||
libraries_results.append(('PIL+JPEG', True, 'Got it!'))
|
||||
except Exception, e:
|
||||
status_summary['libraries'] = False
|
||||
msg = "Failed to create a jpeg image: %s" % e
|
||||
libraries_results.append(('PIL+JPEG', False, msg))
|
||||
|
||||
# Check file paths / permissions
|
||||
filepaths = (
|
||||
(settings.NETAPP_STORAGE, os.R_OK | os.W_OK, "We want read + write."),
|
||||
|
@ -112,6 +125,7 @@ def monitor(request):
|
|||
|
||||
return jingo.render(request, 'services/monitor.html',
|
||||
{'memcache_results': memcache_results,
|
||||
'libraries_results': libraries_results,
|
||||
'filepath_results': filepath_results,
|
||||
'redis_results': redis_results,
|
||||
'hera_results': hera_results,
|
||||
|
|
Загрузка…
Ссылка в новой задаче