예제 #1
0
def inventory_df_netapp(info):
    mplist = []
    for volume, size_kb, _used_kb in info:
        if saveint(
                size_kb
        ) > 0:  # Exclude filesystems with zero size (some snapshots)
            mplist.append(volume)
    return df_discovery(host_extra_conf(host_name(), filesystem_groups),
                        mplist)
예제 #2
0
def df_inventory(mplist):
    group_patterns: Dict[str, Tuple[List[str], List[str]]] = {}
    for groups in host_extra_conf(host_name(), filesystem_groups):
        for group in transform_filesystem_groups(groups):
            grouping_entry = group_patterns.setdefault(group['group_name'], ([], []))
            grouping_entry[0].extend(group['patterns_include'])
            grouping_entry[1].extend(group['patterns_exclude'])

    ungrouped_mountpoints, groups = ungrouped_mountpoints_and_groups(mplist, group_patterns)

    return [(mp, {}) for mp in ungrouped_mountpoints] \
            + [(group, {"patterns": group_patterns[group]}) for group in groups]
예제 #3
0
def _compile_params() -> Dict[str, Any]:
    compiled_params: Dict[str, Any] = {"reclassify_patterns": []}

    for rule in host_extra_conf(host_name(), cmk.base.config.logwatch_rules):
        if isinstance(rule, dict):
            compiled_params["reclassify_patterns"].extend(rule["reclassify_patterns"])
            if "reclassify_states" in rule:
                # (mo) wondering during migration: doesn't this mean the last one wins?
                compiled_params["reclassify_states"] = rule["reclassify_states"]
        else:
            compiled_params["reclassify_patterns"].extend(rule)

    return compiled_params
예제 #4
0
def inventory_freeipmi(parsed):
    rules = host_extra_conf(host_name(), inventory_ipmi_rules)
    if rules:
        mode, ignore_params = ipmi.transform_discovery_ruleset(rules[0])
    else:
        mode, ignore_params = 'single', {}

    if mode == "summarize":
        yield "Summary FreeIPMI", {}
    else:
        for sensorname, data in parsed.items():
            if not ipmi_ignore_entry(sensorname, data["status_txt"], ignore_params):
                yield sensorname, {}
예제 #5
0
def inventory_diskstat_generic(parsed):
    # Skip over on empty data
    if not parsed:
        return

    # New style: use rule based configuration, defaulting to summary mode
    if diskstat_inventory_mode == "rule":
        hits = host_extra_conf(host_name(), diskstat_inventory)
        if len(hits) > 0:
            modes = hits[0]
        else:
            modes = ["summary"]

    elif diskstat_inventory_mode == "single":
        modes = ["physical"]
    elif diskstat_inventory_mode == "summary":
        modes = ["summary"]
    else:
        modes = ["legacy"]

    inventory = []
    if "summary" in modes:
        inventory.append(("SUMMARY", "diskstat_default_levels"))

    if "legacy" in modes:
        inventory += [("read", None), ("write", None)]

    for line in parsed:
        name = line[1]
        if "physical" in modes and \
           not ' ' in name and \
           not diskstat_diskless_pattern.match(name):
            inventory.append((name, "diskstat_default_levels"))

        if "lvm" in modes and \
           name.startswith("LVM "):
            inventory.append((name, "diskstat_default_levels"))

        if "vxvm" in modes and \
           name.startswith("VxVM "):
            inventory.append((name, "diskstat_default_levels"))

        if "diskless" in modes and \
           diskstat_diskless_pattern.match(name):
            # Sort of partitions with disks - typical in XEN virtual setups.
            # Eg. there are xvda1, xvda2, but no xvda...
            inventory.append((name, "diskstat_default_levels"))

    return inventory
예제 #6
0
def inventory_hr_fs(info):
    mplist = []
    for hrtype, hrdescr, _hrunits, hrsize, _hrused in info:
        hrdescr = fix_hr_fs_mountpoint(hrdescr)
        # NOTE: These types are defined in the HR-TYPES-MIB.
        #       .1.3.6.1.2.1.25.2.1 +
        #                           +-> .4 "hrStorageFixedDisk"
        if hrtype in [ ".1.3.6.1.2.1.25.2.1.4",
                       # This strange value below is needed for VCenter Appliances
                       ".1.3.6.1.2.1.25.2.3.1.2.4"] and \
                hrdescr not in inventory_df_exclude_mountpoints and \
                saveint(hrsize) != 0:
            mplist.append(hrdescr)
    return df_discovery(host_extra_conf(host_name(), filesystem_groups),
                        mplist)
예제 #7
0
def _get_discovery_groups():
    """Isolate the remaining API violation w.r.t. parameters"""
    return host_extra_conf(
        host_name(),
        get_checkgroup_parameters('logwatch_groups', []),
    )
예제 #8
0
def get_ec_rule_params():
    """Isolate the remaining API violation w.r.t. parameters"""
    return host_extra_conf(
        host_name(),
        get_checkgroup_parameters('logwatch_ec', []),
    )