#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# |             ____ _               _        __  __ _  __           |
# |            / ___| |__   ___  ___| | __   |  \/  | |/ /           |
# |           | |   | '_ \ / _ \/ __| |/ /   | |\/| | ' /            |
# |           | |___| | | |  __/ (__|   <    | |  | | . \            |
# |            \____|_| |_|\___|\___|_|\_\___|_|  |_|_|\_\           |
# |                                                                  |
# | Copyright Mathias Kettner 2018             mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software;  you can redistribute it and/or modify it
# under the  terms of the  GNU General Public License  as published by
# the Free Software Foundation in version 2.  check_mk is  distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;  with-
# out even the implied warranty of  MERCHANTABILITY  or  FITNESS FOR A
# PARTICULAR PURPOSE. See the  GNU General Public License for more de-
# tails. You should have  received  a copy of the  GNU  General Public
# License along with GNU Make; see the file  COPYING.  If  not,  write
# to the Free Software Foundation, Inc., 51 Franklin St,  Fifth Floor,
# Boston, MA 02110-1301 USA.

#.
#   .--temperature---------------------------------------------------------.
#   |      _                                      _                        |
#   |     | |_ ___ _ __ ___  _ __   ___ _ __ __ _| |_ _   _ _ __ ___       |
#   |     | __/ _ \ '_ ` _ \| '_ \ / _ \ '__/ _` | __| | | | '__/ _ \      |
#   |     | ||  __/ | | | | | |_) |  __/ | | (_| | |_| |_| | | |  __/      |
#   |      \__\___|_| |_| |_| .__/ \___|_|  \__,_|\__|\__,_|_|  \___|      |
#   |                       |_|                                            |
#   +----------------------------------------------------------------------+
#   |                                                                      |
#   '----------------------------------------------------------------------'

check_info['enviromux_external'] = {
    'parse_function': parse_enviromux_external,
    'inventory_function': inventory_enviromux_temperature,
    'check_function': check_enviromux_temperature,
    'service_description': 'Sensor External %s',
    'snmp_info': (
        '.1.3.6.1.4.1.3699.1.1.11.1.5.1.1',
        [
            "1",  # extSensorIndex
            "2",  # extSensorType
            "3",  # extSensorDescription
            "4",  # extSensorConnector
            "5",  # extSensorGroupNB
            "6",  # extSensorGroup
            "7",  # extSensorValue
            "8",  # extSensorUnit
            "9",  # extSensorUnitName
            "10",  # extSensorStatus
            "11",  # extSensorMinThreshold
            "12",  # extSensorMaxThreshold
            #  These appear to only return bogus values
            #"12", # intSensorMinWarnThreshold
            #"13", # intSensorMaxWarnThreshold
        ]),
    'includes': ["temperature.include", "enviromux.include"],
    'has_perfdata': True,
    'snmp_scan_function': enviromux_scan_function,
    'group': "temperature",
}

#.
#   .--Voltage-------------------------------------------------------------.
#   |                 __     __    _ _                                     |
#   |                 \ \   / /__ | | |_ __ _  __ _  ___                   |
#   |                  \ \ / / _ \| | __/ _` |/ _` |/ _ \                  |
#   |                   \ V / (_) | | || (_| | (_| |  __/                  |
#   |                    \_/ \___/|_|\__\__,_|\__, |\___|                  |
#   |                                         |___/                        |
#   +----------------------------------------------------------------------+
#   |                                                                      |
#   '----------------------------------------------------------------------'

check_info['enviromux_external.voltage'] = {
    'inventory_function': inventory_enviromux_voltage,
    'check_function': check_enviromux_voltage,
    'service_description': 'Sensor External %s',
    'has_perfdata': True,
    'group': "voltage",
    'default_levels_variable': "enviromux_default_levels",
    'includes': ["enviromux.include"],
}

#.
#   .--Humidity------------------------------------------------------------.
#   |              _   _                 _     _ _ _                       |
#   |             | | | |_   _ _ __ ___ (_) __| (_) |_ _   _               |
#   |             | |_| | | | | '_ ` _ \| |/ _` | | __| | | |              |
#   |             |  _  | |_| | | | | | | | (_| | | |_| |_| |              |
#   |             |_| |_|\__,_|_| |_| |_|_|\__,_|_|\__|\__, |              |
#   |                                                  |___/               |
#   +----------------------------------------------------------------------+
#   |                                                                      |
#   '----------------------------------------------------------------------'

check_info['enviromux_external.humidity'] = {
    'inventory_function': inventory_enviromux_humidity,
    'check_function': check_enviromux_humidity,
    'service_description': 'Sensor External %s',
    'has_perfdata': True,
    'includes': ["humidity.include", "enviromux.include"],
    'group': "humidity",
}
