Example #1
0
def test_all_man_pages(tmpdir):
    f1 = tmpdir.join(".asd").write("")
    f2 = tmpdir.join("asd~").write("")
    f3 = tmpdir.join("if").write("")

    pages = man_pages.all_man_pages()

    assert len(pages) > 1241
    assert ".asd" not in pages
    assert "asd~" not in pages

    assert pages["if"] == "%s/if" % tmpdir
    assert pages["if64"] == "%s/checkman/if64" % cmk_path()
Example #2
0
def test_all_man_pages(tmpdir):
    f1 = tmpdir.join(".asd").write("")
    f2 = tmpdir.join("asd~").write("")
    f3 = tmpdir.join("if").write("")

    pages = man_pages.all_man_pages()

    assert len(pages) > 1241
    assert ".asd" not in pages
    assert "asd~" not in pages

    assert pages["if"] == "%s/if" % tmpdir
    assert pages["if64"] == "%s/checkman/if64" % cmk_path()
Example #3
0
def automation_get_real_time_checks():
    manuals = man_pages.all_man_pages()

    checks = []
    for check_type, check in check_info.items():
        if check["handle_real_time_checks"]:
            title = check_type
            try:
                manfile = manuals.get(check_type)
                if manfile:
                    title = file(manfile).readline().strip().split(":", 1)[1].strip()
            except Exception:
                if opt_debug:
                    raise

            checks.append((check_type, "%s - %s" % (check_type, title)))

    return checks
Example #4
0
def automation_get_real_time_checks():
    manuals = man_pages.all_man_pages()

    checks = []
    for check_type, check in check_info.items():
        if check["handle_real_time_checks"]:
            title = check_type
            try:
                manfile = manuals.get(check_type)
                if manfile:
                    title = file(manfile).readline().strip().split(":", 1)[1].strip()
            except Exception:
                if cmk.debug.enabled():
                    raise

            checks.append((check_type, "%s - %s" % (check_type, title)))

    return checks
Example #5
0
def automation_get_check_information():
    manuals = man_pages.all_man_pages()

    checks = {}
    for check_type, check in check_info.items():
        try:
            manfile = manuals.get(check_type)
            if manfile:
                title = file(manfile).readline().strip().split(":", 1)[1].strip()
            else:
                title = check_type
            checks[check_type] = { "title" : title }
            if check["group"]:
                checks[check_type]["group"] = check["group"]
            checks[check_type]["service_description"] = check.get("service_description","%s")
            checks[check_type]["snmp"] = check_uses_snmp(check_type)
        except Exception, e:
            if opt_debug:
                raise
            raise MKAutomationError("Failed to parse man page '%s': %s" % (check_type, e))
Example #6
0
def automation_get_check_information():
    manuals = man_pages.all_man_pages()

    checks = {}
    for check_type, check in check_info.items():
        try:
            manfile = manuals.get(check_type)
            if manfile:
                title = file(manfile).readline().strip().split(":", 1)[1].strip()
            else:
                title = check_type
            checks[check_type] = { "title" : title }
            if check["group"]:
                checks[check_type]["group"] = check["group"]
            checks[check_type]["service_description"] = check.get("service_description","%s")
            checks[check_type]["snmp"] = check_uses_snmp(check_type)
        except Exception, e:
            if cmk.debug.enabled():
                raise
            raise MKAutomationError("Failed to parse man page '%s': %s" % (check_type, e))
Example #7
0
def automation_get_check_information():
    manuals = man_pages.all_man_pages()

    checks = {}
    for check_type, check in check_info.items():
        try:
            manfile = manuals.get(check_type)
            # TODO: Use cmk.man_pages module standard functions to read the title
            if manfile:
                title = file(manfile).readline().strip().split(":", 1)[1].strip()
            else:
                title = check_type
            checks[check_type] = { "title" : title.decode("utf-8") }
            if check["group"]:
                checks[check_type]["group"] = check["group"]
            checks[check_type]["service_description"] = check.get("service_description","%s")
            checks[check_type]["snmp"] = check_uses_snmp(check_type)
        except Exception, e:
            if cmk.debug.enabled():
                raise
            raise MKAutomationError("Failed to parse man page '%s': %s" % (check_type, e))
Example #8
0
def test_load_all_man_pages():
    for name in man_pages.all_man_pages().keys():
        man_page = man_pages.load_man_page(name)
        assert type(man_page) == dict
        _check_man_page_structure(man_page)
Example #9
0
def test_load_all_man_pages():
    for name in man_pages.all_man_pages().keys():
        man_page = man_pages.load_man_page(name)
        assert type(man_page) == dict
        _check_man_page_structure(man_page)