def check(containers):
    project = openshift.get_project()
    pods = openshift.get_running_pod_names(
        project, container_names=containers.split(','))
    collections = map(parse_mongo_result,
                      openshift.exec_in_pods(project, pods, check_mongodb_cmd))
    result = topic_existance(topics, collections)

    return report(pods, project, result)
def check(containers):
    project = openshift.get_project()

    pods = openshift.get_running_pod_names(
        project, container_names=containers.split(','))

    rs_statuses = map(parse_mongo_result,
                      openshift.exec_in_pods(project, pods, check_mongodb_cmd))
    nag_statuses = map(analize, rs_statuses)

    return report(pods, rs_statuses, nag_statuses)
def do_request(project):
    results = []
    errors = []
    pods = openshift.get_running_pod_names(project)
    command_args = ['which', 'androidctl']
    for pod in pods:
        if "android-sdk" in pod:
            command_response = openshift.exec_in_pod(project, pod, command_args)
            if "/usr/bin/androidctl" in command_response:
                results.append(nagios.OK)
            else:
                results.append(nagios.CRIT)
        else:
            results.append(nagios.CRIT)
    return results, errors
Example #4
0
def check(warn, crit):
    if crit < warn:
        msg = "critical threshold cannot be lower than warning threshold: %d < %d"
        raise ValueError(msg % (crit, warn))

    project = openshift.get_project()

    results = []

    pods = openshift.get_running_pod_names(project)
    execs = openshift.exec_in_pods(project, pods, check_disk_cmd)
    for pod, lines in zip(pods, execs):
        results.extend(analize(pod, parse_df_lines(lines), warn, crit))

    return report(results)
Example #5
0
def check():
    issues = []
    project = openshift.get_project()
    deploymentConfigs = openshift.get_deploymentconfigs(project)
    for deploymentConfig in deploymentConfigs["items"]:
        componentName = deploymentConfig["metadata"]["name"]
        pods = openshift.get_running_pod_names(
            project, container_names=componentName)
        nodes = openshift.get_nodes_from_names(pods)
        if len(pods) > 1:
            for node in set(nodes):
                nodeCount = nodes.count(node)
                if nodeCount > 1:
                    issues.append("WARN: %s has %s pods running on the same node: %s" % (
                        componentName, nodeCount, node))
    return report(issues)
def check():
    project = openshift.get_project()
    pods = openshift.get_running_pod_names(project, container_names="mongodb")
    if not pods:
        output = "Unable to locate any mongodb containers"
        return nagios.UNKNOWN
    nodes = openshift.get_nodes_from_names(pods)
    nodes_pods = dict(zip(pods, nodes))
    if len(nodes) < 3:
        output = nodes_pods
        return nagios.CRIT
    if nodes[0] == nodes[1] or nodes[0] == nodes[2] or nodes[1] == nodes[2]:
        output = nodes_pods
        nag_status = nagios.WARN
    else:
        output = nodes_pods
        nag_status = nagios.OK
    return report(nag_status, output)