Example #1
0
# These functions were used in some specific checks until 1.6. Don't add it to
# the future check API. It's kept here for compatibility reasons for now.
def tags_of_host(hostname):
    return _config.get_config_cache().get_host_config(hostname).tags


# These functions were used in some specific checks until 1.6. Don't add it to
# the future check API. It's kept here for compatibility reasons for now.
def is_ipv6_primary(hostname):
    return _config.get_config_cache().get_host_config(hostname).is_ipv6_primary


nagios_illegal_chars = _config.nagios_illegal_chars
is_cmc = _config.is_cmc

get_age_human_readable = lambda secs: str(render.Age(secs))
get_bytes_human_readable = render.fmt_bytes
get_percent_human_readable = render.percent
quote_shell_string = _utils.quote_shell_string


def get_checkgroup_parameters(group, deflt=None):
    return _config.checkgroup_parameters.get(group, deflt)


# TODO: Replace by some render.* function / move to render module?
def get_filesize_human_readable(size):
    """Format size of a file for humans.

    Similar to get_bytes_human_readable, but optimized for file
    sizes. Really only use this for files. We assume that for smaller
Example #2
0
# These functions were used in some specific checks until 1.6. Don't add it to
# the future check API. It's kept here for compatibility reasons for now.
def tags_of_host(hostname: HostName) -> Set[str]:
    return _config.get_config_cache().get_host_config(hostname).tags


# These functions were used in some specific checks until 1.6. Don't add it to
# the future check API. It's kept here for compatibility reasons for now.
def is_ipv6_primary(hostname: HostName) -> bool:
    return _config.get_config_cache().get_host_config(hostname).is_ipv6_primary


nagios_illegal_chars = _config.nagios_illegal_chars
is_cmc = _config.is_cmc

get_age_human_readable = lambda secs: "%s" % render.Age(secs)
get_bytes_human_readable = render.fmt_bytes
get_nic_speed_human_readable = render.fmt_nic_speed
get_percent_human_readable = render.percent
get_number_with_precision = render.fmt_number_with_precision
quote_shell_string = _cmk_utils.quote_shell_string


def get_checkgroup_parameters(group: str, deflt: _Ruleset) -> _Ruleset:
    return _config.checkgroup_parameters.get(group, deflt)


# TODO: Replace by some render.* function / move to render module?
def get_filesize_human_readable(size: float) -> str:
    """Format size of a file for humans.
Example #3
0
# the future check API. It's kept here for compatibility reasons for now.
def tags_of_host(hostname: HostName) -> Set[str]:
    return _config.get_config_cache().get_host_config(hostname).tags


# These functions were used in some specific checks until 1.6. Don't add it to
# the future check API. It's kept here for compatibility reasons for now.
def is_ipv6_primary(hostname: HostName) -> bool:
    return _config.get_config_cache().get_host_config(hostname).is_ipv6_primary


nagios_illegal_chars = _config.nagios_illegal_chars
is_cmc = _config.is_cmc

get_age_human_readable: Callable[[float],
                                 str] = lambda secs: "%s" % render.Age(secs)
get_bytes_human_readable = render.fmt_bytes
get_nic_speed_human_readable = render.fmt_nic_speed
get_percent_human_readable = render.percent
get_number_with_precision = render.fmt_number_with_precision
quote_shell_string = _cmk_utils.quote_shell_string


def get_checkgroup_parameters(group: str, deflt: _Ruleset) -> _Ruleset:
    return _config.checkgroup_parameters.get(group, deflt)


# TODO: Replace by some render.* function / move to render module?
def get_filesize_human_readable(size: float) -> str:
    """Format size of a file for humans.