2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2014 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 # tsmfarm3 LIBRARY3 DRIVE01 LOADED YES 000782XXXX
29 # tsmfarm3 LIBRARY3 DRIVE02 LOADED YES 002348XXXX
30 # tsmfarm3 LIBRARY3 DRIVE03 EMPTY YES 000783XXXX
31 # tsmfarm3 LIBRARY3 DRIVE04 EMPTY NO 000784XXXX
32 # tsmfarm3 LIBRARY3 DRIVE05 LOADED YES 000785XXXX
35 # default GPFSFILE GPFSFILE1 UNKNOWN YES
36 # default GPFSFILE GPFSFILE10 UNKNOWN YES
37 # default GPFSFILE GPFSFILE11 UNKNOWN YES
38 # default GPFSFILE GPFSFILE12 UNKNOWN YES
39 # default GPFSFILE GPFSFILE13 UNKNOWN YES
41 # Possible values for state:
49 # Possible values for loaded:
56 def inventory_tsm_drives(info
):
60 inst
, library
, drive
, _state
, _online
= line
[:5]
61 item
= "%s / %s" % (library
, drive
)
63 item
= inst
+ " / " + item
64 inventory
.append((item
, None))
69 def check_tsm_drives(item
, params
, info
):
72 inst
, library
, drive
, state
, online
= line
[:5]
73 libdev
= "%s / %s" % (library
, drive
)
74 if item
== libdev
or item
== inst
+ " / " + libdev
:
77 infotext
= "[%s] " % serial
83 infotext
+= "state: %s" % state
84 if state
in ["UNAVAILABLE", "UNKNOWN"]:
88 infotext
+= ", online: %s" % online
93 return (monstate
, infotext
)
94 return (3, "drive not found")
97 check_info
['tsm_drives'] = {
98 "check_function": check_tsm_drives
,
99 "inventory_function": inventory_tsm_drives
,
100 "service_description": "TSM Drive %s",