Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / sansymphony_pool
blob9e1475c5f5e624b4afba311011ab80d3d5e6d555
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.
27 sansymphony_pool_default_values = (80, 90)
30 def inventory_sansymphony_pool(info):
31 for line in info:
32 yield line[0], "sansymphony_pool_default_values"
35 def check_sansymphony_pool(item, params, info):
36 warn, crit = params
37 for poolname, allocated, poolstatus, cachemode, pooltype in info:
38 if poolname == item:
39 if poolstatus == "Running" and cachemode == "ReadWrite":
40 yield 0, "%s pool %s is running, its cache is in %s mode" % (pooltype, poolname,
41 cachemode)
42 elif poolstatus == "Running" and cachemode != "ReadWrite":
43 yield 1, "%s Pool %s is %s, its cache is %s" % (pooltype, poolname, poolstatus,
44 cachemode)
45 else:
46 yield 2, "%s pool %s is %s, its cache is in %s mode" % (pooltype, poolname,
47 poolstatus, cachemode)
49 allocated = int(allocated)
50 infotxt = "Pool allocation: %d%%" % allocated
51 levels = " (warn/crit at %d/%d%%)" % (warn, crit)
52 perfdata = [("pool_allocation", allocated, warn, crit)]
54 if allocated >= crit:
55 yield 2, infotxt + levels, perfdata
56 elif allocated >= warn:
57 yield 1, infotxt + levels, perfdata
58 else:
59 yield 0, infotxt, perfdata
62 check_info['sansymphony_pool'] = {
63 "check_function": check_sansymphony_pool,
64 "inventory_function": inventory_sansymphony_pool,
65 "service_description": "sansymphony Pool %s",
66 "has_perfdata": True,
67 "group": "sansymphony_pool",