#!/usr/bin/python
# -*- coding: utf-8; py-indent-offset: 4 -*-
#  _______ __   _ ____     __
# |       |  \ | |___ \   / /
# |       |   \| | __) | / /-,_
# |       | |\   |/ __/ /__   _|
# |_______|_| \__|_____|   |_|
#
# @author Markus Birth <markus.birth@weltn24.de>

def inventory_evertz_irda7881_temp(info):
    inventory = []
    for oidend, fpgaTemp in info:
        inventory.append( ( "FPGA Temperature", None ) )
    return inventory

def check_evertz_irda7881_temp(item, _no_params, info):
    status = 0
    for oidend, fpgaTemp in info:
        fpgaTemp = int(fpgaTemp)

        message = u"%i℃" % ( fpgaTemp )

        perfdata = [ ("FPGA_Temp", fpgaTemp, None, None, -100, 100) ]

        return status, message, perfdata

    return 3, "%s not found in SNMP data." % item

check_info["evertz_irda7881_temp"] = {
    "check_function"        : check_evertz_irda7881_temp,
    "inventory_function"    : inventory_evertz_irda7881_temp,
    "service_description"   : "%s",
    "snmp_info"             : (".1.3.6.1.4.1.6827.50.322.48.1.1.1", [
                                OID_END,
                                     1,  #fpgaTemp
                              ]),
    "snmp_scan_function"    : lambda oid: oid(".1.3.6.1.4.1.6827.50.322.2.1.1.1.1"),
    "has_perfdata"          : True
}
