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

# Example output:
# <<<check_mk>>>
# Version: 1.2.5i6
# BuildDate: Aug 22 2014
# Architecture: 64bit
# AgentOS: windows
# Hostname: dbserver-01


def inv_check_mk(parsed, inventory_tree):
    hostname = parsed.get("Hostname")
    if hostname:
        inventory_tree.get_dict("networking.")["hostname"] = hostname

    version = parsed.get("Version")
    if version:
        inventory_tree.get_dict("software.applications.check_mk.")["agent_version"] = version


inv_info['check_mk'] = {
    "inv_function": inv_check_mk,
}
