#!/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_cmk_inv(params):
    if params is None:
        params = {}  # convert from legacy rule syntax

    args = [
        "--inv-fail-status=%d" % params.get("fail_status", 1),
        "--hw-changes=%d" % params.get("hw_changes", 0),
        "--sw-changes=%d" % params.get("sw_changes", 0),
        "--sw-missing=%d" % params.get("sw_missing", 0),
        "--inventory-as-check",
        "$HOSTNAME$",
    ]

    return args


active_check_info["cmk_inv"] = {
    "command_line": "cmk $ARG1$",
    "argument_function": check_cmk_inv,
    "service_description": lambda x: "Check_MK HW/SW Inventory",
}
