JR

One of our Network Engineers needed some monitoring (internal temp, external temp, and external humidity) added for an AVTech Room Alert 4E unit, preferably using a check_MK plugin. Couldn’t find one in any repos or in git, so decided to add this to a growing collection of plugins I’ve been working on. Another request from the same team: MinuteMan UPS units. I’ll be adding to my check_mk_bag git repo periodically with any new, custom check plugins. I’ll also try to get these on Check_MK’s Exchange. For now, here’s some environmental monitors, of course with perfdata output — gotta have the metrics available for trending!

As typical with check_MK checks, this supports auto-inventory (scan function configured):

ra4e_sensor_temp_defaultlevels = (28, 32)

def inventory_ra4e_sensor_temp(info):
    inventory = []
    for tempc, tempf, desc in info:
        inventory.append( (desc, "ra4e_sensor_temp_defaultlevels") )
    import pprint ; pprint.pprint(info)
    return inventory

def check_ra4e_sensor_temp(item, params, info):
    for tempc, tempf, desc in info:
        if desc == item:
            warn, crit = params
        temp = (int(tempc)/100)
        tempf = (int(tempf)/100)
            if tempc != "" and tempf != "":
                infotext = "%.1f " % tempf + "F (%.1f C)" % temp + " (warn/crit at %.1f/%.1f " % (warn, crit) + "C)"
                perfdata = [ ( "temperature", temp, warn, crit ) ]
                if temp >= crit:
                    return (2, "Temperature is: " + infotext, perfdata)
                elif temp >= warn:
                    return (1, "Temperature is: " + infotext, perfdata)
                else:
                    return (0, "Temperature is: " + infotext, perfdata )
            else:
                return (3, "Sensor is offline")
    return (3, "Sensor not found")

check_info["ra4e_sensor_temp"] = {
    'check_function':          check_ra4e_sensor_temp,
    'inventory_function':      inventory_ra4e_sensor_temp,
    'service_description':     'Temperature %s',
    'has_perfdata':            True,
    'snmp_info':               (
        ".1.3.6.1.4.1.20916.1.6.1.2.1", [
            1, #digital-sen1 - Degrees in Celsius
            2, #digital-sen1 - Degrees in Fahrenheit
            6, #digital-sen1 - Description 
        ],
    ),
    'snmp_scan_function':      \
         lambda oid: "Room Alert" in oid(".1.3.6.1.2.1.1.1.0"),
    'group':                   'room_temperature',