예제 #1
0
파일: views.py 프로젝트: james4388/zamboni
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})
예제 #2
0
파일: views.py 프로젝트: darkwing/zamboni
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})
예제 #3
0
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})
예제 #4
0
파일: views.py 프로젝트: jaliste/zamboni
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})
예제 #5
0
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
예제 #6
0
파일: monitors.py 프로젝트: tmp0230/zamboni
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
예제 #7
0
파일: monitors.py 프로젝트: LucianU/zamboni
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
예제 #8
0
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
예제 #9
0
파일: views.py 프로젝트: MechanisM/zamboni
        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,
예제 #10
0
    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)
예제 #11
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)