#!/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:
# <<<vxvm_enclosures>>>
# LIO-Sechs         aluadisk       ALUAdisk             CONNECTED    ALUA        3


def check_vxvm_enclosures(item, params, info):
    for line in info:
        if line[0] == item:
            if line[3] != "CONNECTED":
                return (2, "Status is %s" % line[3])
            return (0, "Status is CONNECTED")
    return (3, "Item not found")


check_info["vxvm_enclosures"] = {
    "check_function": check_vxvm_enclosures,
    "inventory_function": lambda info: [(item[0], None) for item in info],
    "service_description": "Enclosure %s",
}
