Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / barracuda_mailqueues
blobe84a03cf34b124adb92dd434b9d3b559d9d6cc63
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2015 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.20632.2.2 0
28 # .1.3.6.1.4.1.20632.2.3 19
29 # .1.3.6.1.4.1.20632.2.4 17
30 # .1.3.6.1.4.1.20632.2.60 434
32 # Suggested by customer
33 factory_settings["barracuda_mailq_default_levels"] = {
34 "deferred": (80, 100),
35 "active": (80, 100),
39 def inventory_barracuda_mailqueues(info):
40 return [("", {})]
43 def check_barracuda_mailqueues(_no_item, params, info):
44 in_queue_str, active_queue_str, deferred_queue_str, daily_sent = info[0]
45 for queue_type, queue in [
46 ("Active", int(active_queue_str)),
47 ("Deferred", int(deferred_queue_str)),
49 state = 0
50 infotext = "%s: %s" % (queue_type, queue)
51 warn, crit = params[queue_type.lower()]
53 if queue >= crit:
54 state = 2
55 elif queue >= warn:
56 state = 1
57 if state:
58 infotext += " (warn/crit at %d/%d %s mails)" % (warn, crit, queue_type.lower())
60 yield state, infotext, [("mail_queue_%s_length" % queue_type.lower(), queue, warn, crit)]
62 yield 0, "Incoming: %s" % in_queue_str
63 if daily_sent:
64 yield 0, "Daily sent: %s" % daily_sent
67 check_info['barracuda_mailqueues'] = {
68 'inventory_function' : inventory_barracuda_mailqueues,
69 'check_function' : check_barracuda_mailqueues,
70 'service_description' : 'Mail Queue %s',
71 'has_perfdata' : True,
72 # The barracuda spam firewall does not response or returns a timeout error
73 # executing 'snmpwalk' on whole tables. But we can workaround here specifying
74 # all needed OIDs. Then we can use 'snmpget' and 'snmpwalk' on these single OIDs.
75 'snmp_info' : (".1.3.6.1.4.1.20632.2", [
76 "2", # inQueue
77 "3", # outQueue
78 "4", # deferredQueue
79 "60", # dailySent
80 ]),
81 'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.8072.3.2.10") and \
82 "barracuda" in oid(".1.3.6.1.2.1.1.1.0").lower(),
83 'default_levels_variable' : "barracuda_mailq_default_levels",
84 'group' : "mail_queue_length",