def hera(request): form = FlushForm(initial={"flushprefix": site_settings.SITE_URL}) boxes = [] configured = False # Default to not showing the form. for i in site_settings.HERA: hera = get_hera(i) r = {"location": urlparse(i["LOCATION"])[1], "stats": False} if hera: r["stats"] = hera.getGlobalCacheInfo() configured = True boxes.append(r) if not configured: messages.error(request, "Hera is not (or mis-)configured.") form = None if request.method == "POST" and hera: form = FlushForm(request.POST) if form.is_valid(): expressions = request.POST["flushlist"].splitlines() for url in expressions: num = flush_urls([url], request.POST["flushprefix"], True) msg = "Flushed %d objects from front end cache for: %s" % (len(num), url) log.info("[Hera] (user:%s) %s" % (request.user, msg)) messages.success(request, msg) return jingo.render(request, "zadmin/hera.html", {"form": form, "boxes": boxes})
def hera(request): form = FlushForm(initial={'flushprefix': settings.SITE_URL}) boxes = [] configured = False # Default to not showing the form. for i in settings.HERA: hera = get_hera(i) r = {'location': urlparse(i['LOCATION'])[1], 'stats': False} if hera: r['stats'] = hera.getGlobalCacheInfo() configured = True boxes.append(r) if not configured: messages.error(request, "Hera is not (or mis-)configured.") form = None if request.method == 'POST' and hera: form = FlushForm(request.POST) if form.is_valid(): expressions = request.POST['flushlist'].splitlines() for url in expressions: num = flush_urls([url], request.POST['flushprefix'], True) msg = ("Flushed %d objects from front end cache for: %s" % (len(num), url)) log.info("[Hera] (user:%s) %s" % (request.user, msg)) messages.success(request, msg) return jingo.render(request, 'zadmin/hera.html', {'form': form, 'boxes': boxes})
def hera(request): form = FlushForm(initial={'flushprefix': settings.SITE_URL}) boxes = [] configured = False # Default to not showing the form. for i in settings.HERA: hera = get_hera(i) r = {'location': urlparse(i['LOCATION'])[1], 'stats': False} if hera: r['stats'] = hera.getGlobalCacheInfo() configured = True boxes.append(r) if not configured: messages.error(request, "Hera is not (or mis-)configured.") form = None if request.method == 'POST' and hera: form = FlushForm(request.POST) if form.is_valid(): expressions = request.POST['flushlist'].splitlines() for url in expressions: num = flush_urls([url], request.POST['flushprefix'], True) msg = ("Flushed %d objects from front end cache for: %s" % (len(num), url)) log.info("[Hera] (user:%s) %s" % (request.user, msg)) messages.success(request, msg) return render(request, 'zadmin/hera.html', {'form': form, 'boxes': boxes})
def hera(request): form = FlushForm(initial={'flushprefix': site_settings.SITE_URL}) hera = get_hera() if not hera: messages.error(request, "Hera is not (or mis-)configured.") form = None stats = None else: stats = hera.getGlobalCacheInfo() if request.method == 'POST' and hera: form = FlushForm(request.POST) if form.is_valid(): expressions = request.POST['flushlist'].splitlines() for url in expressions: num = flush_urls([url], request.POST['flushprefix'], True) msg = ("Flushed %d objects from front end cache for: %s" % (len(num), url)) log.info("[Hera] (user:%s) %s" % (request.user, msg)) messages.success(request, msg) return jingo.render(request, 'zadmin/hera.html', {'form': form, 'stats': stats})
def hera(): hera_results = [] status = True for i in settings.HERA: r = {'location': urlparse(i['LOCATION'])[1], 'result': bool(get_hera(i))} hera_results.append(r) if not hera_results[-1]['result']: status = False return status, hera_results
def hera(): hera_results = [] status = True for i in settings.HERA: r = { 'location': urlparse(i['LOCATION'])[1], 'result': bool(get_hera(i)) } hera_results.append(r) if not hera_results[-1]['result']: status = False return status, hera_results
def hera(): # Zeus is too slow right now to test HERA. We can remove this line once it has been fixed. return True, [] hera_results = [] status = True for i in settings.HERA: r = {'location': urlparse(i['LOCATION'])[1], 'result': bool(get_hera(i))} hera_results.append(r) if not hera_results[-1]['result']: status = False return status, hera_results
def hera(): # Zeus is too slow right now to test HERA. We can remove this line once it has been fixed. return True, [] hera_results = [] status = True for i in settings.HERA: r = { 'location': urlparse(i['LOCATION'])[1], 'result': bool(get_hera(i)) } hera_results.append(r) if not hera_results[-1]['result']: status = False return status, hera_results
filepath_results.append((path, path_exists, path_perms, notes)) status_summary['filepaths'] = filepath_status # Check Redis redis_results = [None, 'REDIS_BACKENDS is not set'] if getattr(settings, 'REDIS_BACKENDS', False): redis_results = check_redis() status_summary['redis'] = all(i for i in redis_results.values()) # Check Hera hera_results = [] status_summary['hera'] = True for i in settings.HERA: r = {'location': urlparse(i['LOCATION'])[1], 'result': bool(get_hera(i))} hera_results.append(r) if not hera_results[-1]['result']: status_summary['hera'] = False # If anything broke, send HTTP 500 if not all(status_summary.values()): status = 500 if format == '.json': return http.HttpResponse(json.dumps(status_summary), status=status) return jingo.render(request, 'services/monitor.html', {'memcache_results': memcache_results, 'libraries_results': libraries_results,
status_summary["redis"] = bool(redis_results[0]) rabbit_results = check_rabbit() status_summary["rabbit"] = True for queue, (threshold, actual) in rabbit_results.items(): if actual > threshold or actual < 0 or actual is None: status_summary["rabbit"] = False monitor_log.critical( "Celery[%s] did not respond within %s seconds. (actual: %s)" % (queue, threshold, actual) ) # Check Hera hera_results = [] status_summary["hera"] = True for i in settings.HERA: r = {"location": urlparse(i["LOCATION"])[1], "result": bool(get_hera(i))} hera_results.append(r) if not hera_results[-1]["result"]: status_summary["hera"] = False # Check Mongo mongo_results = [] status_summary["mongo"] = bool(mongoutils.connect_mongo()) # If anything broke, send HTTP 500 if not all(status_summary.values()): status = 500 if format == ".json": return http.HttpResponse(json.dumps(status_summary), status=status)
rabbit_results = check_rabbit() status_summary['rabbit'] = True for queue, (threshold, actual) in rabbit_results.items(): if actual > threshold or actual < 0 or actual is None: status_summary['rabbit'] = False monitor_log.critical( 'Celery[%s] did not respond within %s seconds. (actual: %s)' % (queue, threshold, actual)) # Check Hera hera_results = [] status_summary['hera'] = True for i in settings.HERA: r = {'location': urlparse(i['LOCATION'])[1], 'result': bool(get_hera(i))} hera_results.append(r) if not hera_results[-1]['result']: status_summary['hera'] = False # Check Mongo mongo_results = [] status_summary['mongo'] = bool(mongoutils.connect_mongo()) # If anything broke, send HTTP 500 if not all(status_summary.values()): status = 500 if format == '.json': return http.HttpResponse(json.dumps(status_summary), status=status)