Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / synology_raid
blob95a462906d22d41fcbc26ba84da3caf8779bd091
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2013 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
28 def inventory_synology_raid(info):
29 for line in info:
30 yield line[0], None
33 def check_synology_raid(item, _no_params, info):
34 states = {
35 "1": ("OK", 0),
36 "2": ("repairing", 1),
37 "3": ("migrating", 1),
38 "4": ("expanding", 1),
39 "5": ("deleting", 1),
40 "6": ("creating", 1),
41 "7": ("RAID syncing", 0),
42 "8": ("RAID parity checking", 0),
43 "9": ("RAID assembling", 1),
44 "10": ("cancelling", 1),
45 "11": ("degraded", 2),
46 "12": ("crashed", 2),
47 "13": ("scrubbing", 0),
48 "14": ("RAID deploying", 0),
49 "15": ("RAID undeploying", 0),
50 "16": ("RAID mounting cache", 0),
51 "17": ("RAID unmounting cache", 0),
52 "18": ("RAID continue expanding", 1),
53 "19": ("RAID converting", 0),
54 "20": ("RAID migrating", 0),
55 "21": ("RAID status unknown", 3),
57 for raid, state in info:
58 if raid == item:
59 message = "Status: " + states[state][0]
60 return states[state][1], message
63 check_info["synology_raid"] = {
64 "check_function": check_synology_raid,
65 "inventory_function": inventory_synology_raid,
66 "service_description": "RAID %s",
67 "snmp_scan_function": synology_scan_function,
68 "snmp_info": (
69 ".1.3.6.1.4.1.6574.3.1.1",
71 2, #raidName
72 3, #raidStatus
73 ]),
74 "includes": ["synology.include"]