#!/usr/bin/python # -*- encoding: utf-8; py-indent-offset: 4 -*- # +------------------------------------------------------------------+ # | ____ _ _ __ __ _ __ | # | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | # | | |___| | | | __/ (__| < | | | | . \ | # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | # | | # | Copyright Mathias Kettner 2010 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- # ails. 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. # Author: Matthias Henze synology_hdd_temp_default_levels = (40,45) states = ("normal","initialized","not initialized","system partition failed","crashed") def inventory_synology_hdd(checkname, info): # import pprint; pprint.pprint(info) inventory = [] for hdd, model, state, temp in info: if hdd.startswith( 'Disk' ): inventory.append( (hdd, "", "synology_hdd_temp_default_levels") ) return inventory def check_synology_hdd(item, params, info): warn,crit = params for hdd, model, state_, temp_ in info: temp = int(temp_) state = int(state_)-1 perfdata = [("temp", temp, warn, crit)] infotext = " State is %s, HDD temperature is at %s°C (levels at %s/%s)" % (states[state], temp, warn, crit) if hdd == item: if ((state == 3) or (state == 4) or (temp >= crit)): return (2, "Critical - " + infotext, perfdata ) elif (temp >= warn): return (1, "Warning - " + infotext, perfdata ) return (0, "OK - " + infotext, perfdata ) return (3, "UNKNOWN - HDD") check_info['synology_hdd'] = (check_synology_hdd, "Synology %s", 1, inventory_synology_hdd) snmp_info['synology_hdd'] = ( ".1.3.6.1.4.1.6574.2.1.1", [ "2", "3" , "5" ,"6" ] ) def synology_hdd_scan_function(oid): return oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.8072") snmp_scan_functions['synology_hdd'] = synology_hdd_scan_function