#!/usr/bin/python # -*- encoding: utf-8; py-indent-offset: 4 -*- # check_mk check f. LSI Controller # # 10/2010 Matthias Henze # Lizenz: GPL v2 # Example output from agent: # <<>> # ioc:0 vol_id:0 type:IM raidlevel:RAID-1 num_disks:2 size(GB):1396 state: OPTIMAL flags: ENABLED # ioc:0 vol_id:6 type:IM raidlevel:RAID-1 num_disks:2 size(GB):1862 state: OPTIMAL flags: ENABLED # inventory def inventory_lsi_vols(checkname, info): inventory = [] for line in info: x = line[1].split(":") unit = x[1] inventory.append( (unit, None) ) return inventory # check def check_lsi_vols(item, param, info): for line in info: status = line[7] x = line[3].split(":") unit_type = x[1] x = line[5].split(":") size = x[1] infotext = "%s (type: %s, size: %s GB)" % (status, unit_type, size) if status == "OPTIMAL": return (0, "OK - volume status is " + infotext) else: return (2, "CRITICAL - volume status is " + infotext) return (3, "UNKNOWN - volume %s not found in agent output" % item) # declare the check to Check_MK check_info['lsi_vols'] = \ (check_lsi_vols, "RAID LSI unit %s", 0, inventory_lsi_vols)