Benutzer-Werkzeuge

Webseiten-Werkzeuge


synology_diskstation

Synology Diskstation

Dieser Check ist vom Qnap-Check von Andre Eckstein abgeleitet.

Es gibt nur einen serverseitiges Plugin, da es sich um einen reinen SNMP-Check handelt.

#!/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 <matthias@mhcsoftware.de>

def inventory_synology_system(checkname, info):
    inventory = []
    inventory.append(("System Status", None)) 
    inventory.append(("Power Status", None)) 
    inventory.append(("System Fan", None)) 
    inventory.append(("CPU Fan", None)) 
    return inventory

def check_synology_system(item, params, info):
    if item == "System Status":
        if info[0][0] == "1":
            return (0, "OK - System Status is OK")
        if info[0][0] == "2":
            return (2, "CRIT - System Status failed")
    if item == "Power Status":
        if info[0][1] == "1":
            return (0, "OK - Power Status is OK")
        if info[0][1] == "2":
            return (2, "CRIT - Power Status failed")
    if item == "System Fan":
        if info[0][2] == "1":
            return (0, "OK - System Fan is OK")
        if info[0][2] == "2":
            return (2, "CRIT - System Fan failed")
    if item == "CPU Fan":
        if info[0][3] == "1":
            return (0, "OK - CPU Fan is OK")
        if info[0][3] == "2":
            return (2, "CRIT - CPU Fan failed")

    return (3, "UNKNOWN - No SNMP Output from agent")

check_info['synology_system'] = (check_synology_system, "Synonlogy %s", 1, inventory_synology_system)

snmp_info['synology_system'] = ( ".1.3.6.1.4.1.6574.1", ["1.0","3.0","4.1.0","4.2.0"] )

def synology_system_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_system'] = synology_system_scan_function

#!/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 <matthias@mhcsoftware.de>

synology_temprature_default_levels = (38,48)

def inventory_synology_temp(checkname, info):
    inventory = []
    inventory.append(("System Temprature", "", "synology_temprature_default_levels"))
    return inventory

def check_synology_temp(item, params, info):
    if item == "System Temprature":
        warn,crit = params
        temp = int(info[0][0])
        perfdata = [("temp", temp, warn, crit)]
        infotxt = " - System Temprature: %d°C (levels at %d/%d)" % (temp, warn, crit)
        if temp >= crit:
            return (2, "CRITICAL" + infotxt, perfdata)
        if temp >= warn:
            return (1, "WARN" + infotxt, perfdata)
        if temp < warn:
            return (0, "OK" + infotxt, perfdata)

    return (3, "UNKNOWN - No SNMP Output from agent")

check_info['synology_temp'] = (check_synology_temp, "Synonlogy %s", 1, inventory_synology_temp)

snmp_info['synology_temp'] = ( ".1.3.6.1.4.1.6574.1", ["2.0"] )

def synology_temp_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_temp'] = synology_temp_scan_function

#!/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 <matthias@mhcsoftware.de>

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

#!/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 <matthias@mhcsoftware.de>

volstates = ("Unknowen","Normal","Repairing","Migrating","Expanding","Deleting","Creating","RaidSyncing","RaidParityChecking","RaidAssembling","Canceling","Degrade","Crashed")

def inventory_synology_volumes(checkname, info):
    inventory = []
    for volid, volstate in info:
      inventory.append( (volid, None) )
    return inventory

def check_synology_volumes(item, _no_params, info):
    for volid, volstate_ in info:
        volstate = int(volstate_)
        infotext = " Volume state is %s" % (volstates[volstate])
        if volid == item:
	    if volstate == 1: 
	        return (0, infotext )
            elif volstate == 11 or volstate == 12:
                return (2, infotext)
            else:
                return (1, infotext )
    return (3, "UNKNOWN - Volume")

check_info['synology_volumes'] = (check_synology_volumes, "Synology Volume %s", 0, inventory_synology_volumes)

snmp_info['synology_volumes'] = ( ".1.3.6.1.4.1.6574.3.1.1", [ "2.0", "3.0" ] )

def synology_volumes_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_volumes'] = synology_volumes_scan_function

synology_diskstation.txt · Zuletzt geändert: 2017/03/17 11:37 von 127.0.0.1