예제 #1
0
def check_es_index():
    """
    Verify that the Case and soon to be added XForm Elastic indices are up to date with what's in couch

    This code is also called in the HQ admin page as well
    """

    es_status = {}
    es_status.update(check_cluster_health())
    es_status.update(check_case_index())
    es_status.update(check_xform_index())
    es_status.update(check_exchange_index())

    do_notify = False
    message = []
    if es_status[CLUSTER_HEALTH] == 'red':
        do_notify = True
        message.append(
            "Cluster health is red - something is up with the ES machine")

    for prefix in ['hqcases', 'xforms', 'cc_exchange']:
        if es_status.get('%s_status' % prefix, False) == False:
            do_notify = True
            message.append("Elasticsearch %s Index Issue: %s" %
                           (prefix, es_status['%s_message' % prefix]))

    if do_notify:
        notify_exception(None, message='\n'.join(message))
예제 #2
0
def check_es_index():
    """
    Verify that the Case and soon to be added XForm Elastic indices are up to date with what's in couch

    This code is also called in the HQ admin page as well
    """

    es_status = {}
    es_status.update(check_cluster_health())
    es_status.update(check_case_index())
    es_status.update(check_xform_index())
    es_status.update(check_exchange_index())

    do_notify = False
    message = []
    if es_status[CLUSTER_HEALTH] == 'red':
        do_notify=True
        message.append("Cluster health is red - something is up with the ES machine")

    for prefix in ['hqcases', 'xforms','cc_exchange']:
        if es_status.get('%s_status' % prefix, False) == False:
            do_notify=True
            message.append("Elasticsearch %s Index Issue: %s" % (prefix, es_status['%s_message' % prefix]))

    if do_notify:
        notify_exception(None, message='\n'.join(message))
예제 #3
0
            max_bytes = stats_dict["limit_maxbytes"]
            curr_items = stats_dict["curr_items"]
            mc_results = "%s Items %s out of %s" % (curr_items, human_bytes(bytes), human_bytes(max_bytes))

    except Exception, ex:
        mc_status = "Offline"
        mc_results = "%s" % ex
    context["memcached_status"] = mc_status
    context["memcached_results"] = mc_results

    context["last_deploy"] = HqDeploy.get_latest()

    # elasticsearch status
    # node status
    context.update(check_cluster_health())
    context.update(check_case_index())
    context.update(check_xform_index())
    context.update(check_exchange_index())

    return render(request, "hqadmin/system_info.html", context)


@require_superuser
def noneulized_users(request, template="hqadmin/noneulized_users.html"):
    context = get_hqadmin_base_context(request)

    days = request.GET.get("days", None)
    days = int(days) if days else 60
    days_ago = datetime.now() - timedelta(days=days)

    users = WebUser.view(
예제 #4
0
            curr_items = stats_dict['curr_items']
            mc_results = "%s Items %s out of %s" % (curr_items, human_bytes(bytes),
                                                    human_bytes(max_bytes))

    except Exception, ex:
        mc_status = "Offline"
        mc_results = "%s" % ex
    context['memcached_status'] = mc_status
    context['memcached_results'] = mc_results

    context['last_deploy'] = HqDeploy.get_latest()

    #elasticsearch status
    #node status
    context.update(check_cluster_health())
    context.update(check_case_index())
    context.update(check_xform_index())
    context.update(check_exchange_index())

    return render(request, "hqadmin/system_info.html", context)

@require_superuser
def noneulized_users(request, template="hqadmin/noneulized_users.html"):
    context = get_hqadmin_base_context(request)

    days = request.GET.get("days", None)
    days = int(days) if days else 60
    days_ago = datetime.now() - timedelta(days=days)

    users = WebUser.view("eula_report/noneulized_users",
        reduce=False,