Modified fjdarye200_pools check Graphic is in MB instead of TB

CMK version: 2.0.0p22.cee
OS version: Appliance

Error message:
The Check is displayed correct in TB but the Graphic is in MB
The one from my modified Version is this:


The Code of the modified check

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

# NOTE: Careful when replacing the *-import below with a more specific import. This can cause
# problems because it might remove variables from the check-context which are necessary for
# resolving legacy discovery results such as [("SUMMARY", "diskstat_default_levels")]. Furthermore,
# it might also remove variables needed for accessing discovery rulesets.
from cmk.base.check_legacy_includes.df import *  # pylint: disable=wildcard-import,unused-wildcard-import
# NOTE: Careful when replacing the *-import below with a more specific import. This can cause
# problems because it might remove variables from the check-context which are necessary for
# resolving legacy discovery results such as [("SUMMARY", "diskstat_default_levels")]. Furthermore,
# it might also remove variables needed for accessing discovery rulesets.
from cmk.base.check_legacy_includes.size_trend import *  # pylint: disable=wildcard-import,unused-wildcard-import
PoolEntry = collections.namedtuple(
    "EternusProvisioningPool",
    ["capacity", "usage", "available"],
)


def parse_fjdarye200_pools_combined(info):
    parsed = {}
    capacity_combined = 0
    usage_combined = 0
    for pool_id, capacity, usage in info:
        try:
            capacity_combined = capacity_combined+int(capacity)
            usage_combined=usage_combined+int(usage)
        except ValueError:
            pass
    parsed["Combined"] = PoolEntry(
        capacity=int(capacity_combined),
        usage=int(usage_combined),
        available=int(capacity_combined) - int(usage_combined),
    )
    return parsed


@get_parsed_item_data
def check_fjdarye200_pools_combined(item, params, entry):
    return df_check_filesystem_single(
        item,
        entry.capacity,
        entry.available,
        0,
        None,
        None,
        params,
    )


check_info["fjdarye200_pools_combined"] = {
    "parse_function": parse_fjdarye200_pools_combined,
    "inventory_function": discover(),
    "check_function": check_fjdarye200_pools_combined,
    "service_description": "Thin Provisioning Pools %s",
    "snmp_info": (
        ".1.3.6.1.4.1.211.1.21.1.150.14.5.2.1",
        [
            "1",  # fjdaryMgtTpPoolNumber
            "3",  # fjdaryMgtTpPoolTotalCapacity
            "4",  # fjdaryMgtTpPoolUsedCapacity
        ]),
    "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.211.1.21.1.150",
    "default_levels_variable": "filesystem_default_levels",
    "group": "filesystem",
    "has_perfdata": True,
}

I found the definition of the original metric in this file cmk/gui/plugins/metrics/translation.py

I think directly modifying this file is the wrong way.

I tried to find an example on how to define a metric for a SNMP Check, but i only found examples for normal checks.

Can someone point me in the right direction ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.