2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2016 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 scan_ibm_tape_library(oid
):
29 return oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.32925.1")
32 def ibm_tape_library_parse_device_name(name
):
33 # strange name format:IBM ULT3580-TD6 00078B5F0F
34 return " ".join([part
for part
in name
.split() if part
])
37 def ibm_tape_library_get_device_state(avail
, status
):
38 # check states suggested by customer
43 "3" : (0, "running full power"),
46 "6" : (3, "not applicable"),
47 "7" : (1, "power off"),
48 "8" : (1, "off line"),
49 "9" : (1, "off duty"),
50 "10" : (1, "degraded"),
51 "11" : (1, "not installed"),
52 "12" : (2, "install error"),
53 "13" : (3, "power save unknown"),
54 "14" : (0, "power save low power mode"),
55 "15" : (0, "power save standby"),
56 "16" : (1, "power cycle"),
57 "17" : (1, "power save warning"),
59 "19" : (1, "not ready"),
60 "20" : (1, "not configured"),
61 "21" : (1, "quiesced"),
67 "3" : (1, "degraded"),
68 "4" : (1, "stressed"),
69 "5" : (1, "predictive failure"),
71 "7" : (2, "non-recoverable error"),
72 "8" : (1, "starting"),
73 "9" : (1, "stopping"),
74 "10" : (1, "stopped "),
75 "11" : (1, "in service"),
76 "12" : (3, "no contact"),
77 "13" : (3, "lost communication"),
78 "14" : (2, "aborted"),
79 "15" : (1, "dormant"),
80 "16" : (2, "supporting entity in error"),
81 "17" : (1, "completed"),
82 "18" : (1, "power mode"),
83 "19" : (1, "dMTF reserved"),
84 "32768" : (3, "vendor reserved"),\
87 for what
, val
, text
in [("avail", avail
, "Availability"), ("status", status
, "Status")]:
88 state
, state_readable
= mapping
[what
][val
]
89 yield state
, "%s: %s" % (text
, state_readable
)