#!/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.


def check_notify_count_arguments(params):
    _description, interval, settings = params
    args = ["-r", interval]

    if "num_per_contact" in settings:
        warn, crit = settings["num_per_contact"]
        args += ["-w", warn]
        args += ["-c", crit]

    return args


active_check_info["notify_count"] = {
    "command_line": "check_notify_count $ARG1$",
    "argument_function": check_notify_count_arguments,
    "service_description": lambda params: "Notify %s" % params[0],
    "has_perfdata": True,
}
