#!/usr/bin/python # -*- encoding: utf-8; py-indent-offset: 4 -*- # check_mk check f. HP Smart Array Controller # # 01/2011 Matthias Henze # Lizenz: GPL v2 # Example output from agent: # <<>> # 4:A OK SATA 0 MB # inventory def inventory_hpsa_array(checkname, info): inventory = [] for line in info: item = line[0] inventory.append( (item, None) ) return inventory # check def check_hpsa_array(item, param, info): for line in info: if line[0] == item: hw = item.split(":") slot = hw[0] array = hw[1] status = line[1] type = line[2] free = line[3] unit = line[4] infotext = "status is %s (slot: %s, array: %s, type: %s free: %s %s)" % (status, slot, array, type, free, unit) if status == "OK": return (0, "OK - " + infotext) else: return (2, "CRITICAL - " + infotext) return (3, "UNKNOWN - Array %s not found in agent output" % item) # declare the check to Check_MK check_info['hpsa_array'] = \ (check_hpsa_array, "HP Smart Array Controller Array %s", 1, inventory_hpsa_array)