#!/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 inventory_quantum_libsmall_door(info):
    return [(None, None)]


def check_quantum_libsmall_door(_no_item, _no_params, info):
    if info[0][0] == "1":
        return 2, "Library door open"
    elif info[0][0] == "2":
        return 0, "Library door closed"
    return 3, "Library door status unknown"



check_info['quantum_libsmall_door'] = {
    "check_function"          : check_quantum_libsmall_door,
    "inventory_function"      : inventory_quantum_libsmall_door,
    "service_description"     : "Tape library door",
    "snmp_info"               : (".1.3.6.1.4.1.3697.1.10.10.1.15.2", [ "0" ]),
    "snmp_scan_function"      : lambda oid: "linux" in oid(".1.3.6.1.2.1.1.1.0", "").lower() \
                                and "library" in oid(".1.3.6.1.2.1.1.6.0", "").lower(),
}
