Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / sym_brightmail_queues
blobf5d4695acc69f4ae4f8f7ed3a212de0c15ad7ddc
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
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.
27 # .1.3.6.1.4.1.393.200.130.2.1.2.1 = INTEGER: 1
28 # .1.3.6.1.4.1.393.200.130.2.1.2.2 = INTEGER: 1
29 # .1.3.6.1.4.1.393.200.130.2.2.1.1.1.1 = INTEGER: 1
30 # .1.3.6.1.4.1.393.200.130.2.2.1.1.1.2 = INTEGER: 2
31 # .1.3.6.1.4.1.393.200.130.2.2.1.1.1.3 = INTEGER: 3
32 # .1.3.6.1.4.1.393.200.130.2.2.1.1.2.1 = STRING: "delivery"
33 # .1.3.6.1.4.1.393.200.130.2.2.1.1.2.2 = STRING: "inbound"
34 # .1.3.6.1.4.1.393.200.130.2.2.1.1.2.3 = STRING: "outbound"
35 # .1.3.6.1.4.1.393.200.130.2.2.1.1.3.1 = Gauge32: 0
36 # .1.3.6.1.4.1.393.200.130.2.2.1.1.3.2 = Gauge32: 1
37 # .1.3.6.1.4.1.393.200.130.2.2.1.1.3.3 = Gauge32: 0
38 # .1.3.6.1.4.1.393.200.130.2.2.1.1.4.1 = Gauge32: 0
39 # .1.3.6.1.4.1.393.200.130.2.2.1.1.4.2 = Gauge32: 0
40 # .1.3.6.1.4.1.393.200.130.2.2.1.1.4.3 = Gauge32: 0
41 # .1.3.6.1.4.1.393.200.130.2.2.1.1.5.1 = Gauge32: 4
42 # .1.3.6.1.4.1.393.200.130.2.2.1.1.5.2 = Gauge32: 0
43 # .1.3.6.1.4.1.393.200.130.2.2.1.1.5.3 = Gauge32: 0
44 # .1.3.6.1.4.1.393.200.130.2.2.1.1.6.1 = Gauge32: 0
45 # .1.3.6.1.4.1.393.200.130.2.2.1.1.6.2 = Gauge32: 0
46 # .1.3.6.1.4.1.393.200.130.2.2.1.1.6.3 = Gauge32: 0
47 # .1.3.6.1.4.1.393.200.130.2.2.1.1.7.1 = Gauge32: 0
48 # .1.3.6.1.4.1.393.200.130.2.2.1.1.7.2 = Gauge32: 0
49 # .1.3.6.1.4.1.393.200.130.2.2.1.1.7.3 = Gauge32: 0
50 # .1.3.6.1.4.1.393.200.130.2.2.1.1.8.1 = Gauge32: 5
51 # .1.3.6.1.4.1.393.200.130.2.2.1.1.8.2 = Gauge32: 0
52 # .1.3.6.1.4.1.393.200.130.2.2.1.1.8.3 = Gauge32: 0
55 def parse_sym_brightmail_queues(info):
56 parsed = {}
57 for descr, connections, dataRate, deferredMessages, \
58 messageRate, queueSize, queuedMessages in info:
59 for k, v in [
60 ("connections", connections),
61 ("dataRate", dataRate),
62 ("deferredMessages", deferredMessages),
63 ("messageRate", messageRate),
64 ("queueSize", queueSize),
65 ("queuedMessages", queuedMessages),
67 try:
68 parsed.setdefault(descr, {}).setdefault(k, int(v))
69 except ValueError:
70 pass
71 return parsed
74 def inventory_sym_brightmail_queues(parsed):
75 for descr in parsed:
76 yield descr, {}
79 def check_sym_brightmail_queues(item, params, parsed):
80 if item not in parsed:
81 yield
82 return
84 data = parsed[item]
85 for key, title in [
86 ("connections", "Connections"),
87 ("dataRate", "Data rate"),
88 ("deferredMessages", "Deferred messages"),
89 ("messageRate", "Message rate"),
90 # Symantec did not document the Unit for the queue. You can still set
91 # some level if you wish.
92 ("queueSize", "Queue size"),
93 ("queuedMessages", "Queued messages"),
95 warn, crit = params.get(key, (None, None))
96 value = data.get(key)
97 if value is None:
98 continue
100 infotext = "%s: %s" % (title, value)
101 state = 0
102 if crit is not None and crit >= crit:
103 state = 2
104 elif warn is not None and warn >= warn:
105 state = 1
106 if state:
107 infotext += " (warn/crit at %s/%s)" % (warn, crit)
108 yield state, infotext
111 check_info["sym_brightmail_queues"] = {
112 "parse_function" : parse_sym_brightmail_queues,
113 "inventory_function" : inventory_sym_brightmail_queues,
114 "check_function" : check_sym_brightmail_queues,
115 "service_description" : "Queue %s",
116 "snmp_scan_function" : lambda oid: "el5_sms" in oid(".1.3.6.1.2.1.1.1.0").lower() or \
117 "el6" in oid(".1.3.6.1.2.1.1.1.0").lower(),
118 "snmp_info" : (".1.3.6.1.4.1.393.200.130.2", [
119 "2.1.1.2", # InstanceDescr
120 "2.1.1.3", # Connections
121 "2.1.1.4", # dataRate
122 "2.1.1.5", # deferedMessages
123 "2.1.1.6", # messageRate
124 "2.1.1.7", # queueSize
125 "2.1.1.8", # queuedMessages
127 "group" : "sym_brightmail_queues",