#!/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.prism import *  # pylint: disable=wildcard-import,unused-wildcard-import

# <<<prism_containers:sep(9)>>>
# name    usage   capacity
# DS01_NFS_Nutanix_B2B_Intern_SAS_Contrainer      2518694292480   38575532134515
# <<<prism_alerts:sep(9)>>>
# timestamp       message severity
# 1456749413164951        DIMM fault detected on host 172.25.209.110. The node is running with 384 GB whereas 512 GB was installed.       kCritical
# 1456748512334905        DIMM fault detected on host 172.25.209.110. The node is running with 384 GB whereas 512 GB was installed.       kCritical
# <<<prism_cluster:sep(9)>>>
# name    version
# CHZRHPCLNB2BINT001      4.5.1.2


def inventory_prism_cluster(parsed):
    yield None, None


def check_prism_cluster(_no_item, _no_params, parsed):
    return 0, "%s, version %s" % (parsed[0]["name"], parsed[0]["version"])


check_info["prism_info"] = {
    "check_function": check_prism_cluster,
    "inventory_function": inventory_prism_cluster,
    "parse_function": parse_prism,
    "service_description": "Prism Cluster",
}
