Module: check_mk
Branch: master
Commit: 99a414345fb3a3dd5a34d693ba74ef34dca329b4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=99a414345fb3a3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jun 8 17:32:05 2012 +0200
tsm_stgpools: new check for TSM Storagepools
---
checks/tsm_stgpools | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/checks/tsm_stgpools b/checks/tsm_stgpools
new file mode 100644
index 0000000..45d798b
--- /dev/null
+++ b/checks/tsm_stgpools
@@ -0,0 +1,98 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 mk(a)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.
+
+# <<<tsm_stgpools>>>
+# tsmfarm2 SL8500_STGPOOL_05 99.9
+# tsmfarm2 SL8500_STGPOOL_05 97.9
+# tsmfarm2 SL8500_LTO4_STGPOOL_01 48.6
+# tsmfarm2 SL8500_LTO4_STGPOOL_01 35.9
+# tsmfarm2 SL8500_LTO4_STGPOOL_01 58.9
+# tsmfarm2 SL8500_LTO4_STGPOOL_01 61.6
+#
+# Example for params
+# params = {
+# "free_below" : 30.0, # consider as free if utilized <= this
+# "levels" : (5, 2), # warn/crit if less then that many free tapes
+# }
+
+factory_settings["tsm_stgpools_default_levels"] = {
+ "free_below" : 70,
+}
+
+def inventory_tsm_stgpools(info):
+ items = set([])
+ for inst, pool, util in info:
+ items.add(inst + " / " + pool)
+ return [ (item, "tsm_stgpools_default_levels") for item in items ]
+
+def check_tsm_stgpools(item, params, info):
+ num_tapes = 0
+ num_free_tapes = 0
+ utilization = 0.0 # in relation to one tape size
+ for inst, pool, util in info:
+ if inst + " / " + pool == item:
+ util = float(util) / 100.0
+ utilization += util
+ num_tapes += 1
+ if util <= params["free_below"] / 100.0:
+ num_free_tapes += 1
+
+ state = 0
+ infotext = "total tapes: %d, tapes less then %d%% full: %d" % \
+ (num_tapes, params["free_below"], num_free_tapes)
+ infotext += ', utilization: %.1f tapes' % utilization
+ if "levels" in params:
+ warn, crit = params["levels"]
+ if num_free_tapes < crit:
+ state = 2
+ infotext += "(!!)"
+ elif num_free_tapes < warn:
+ state = 1
+ infotext += "(!)"
+ else:
+ warn, crit = None, None
+
+ if state == 0 and num_tapes == 0:
+ state = 3
+ infotext = "no tapes in this pool or pool not existant"
+
+ perfdata = [
+ ("tapes", num_tapes),
+ ("free", num_free_tapes, warn, crit),
+ ("util", utilization) ]
+
+ return (state, nagios_state_names[state] + " - " + infotext, perfdata)
+
+
+check_info['tsm_stgpools'] = {
+ "check_function" : check_tsm_stgpools,
+ "inventory_function" : inventory_tsm_stgpools,
+ "service_description" : "TSM Storagepool %s",
+ "has_perfdata" : True,
+ "group" : "tsm_stgpools",
+ "default_levels_variable" : "tsm_stgpools_default_levels",
+}
+