Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / fireeye_mailq
blob7e1c81b931dbaac4d7e091bc3bd0f8539020ca24
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2016 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 # ails. 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.25597.13.1.44.0 0
28 #.1.3.6.1.4.1.25597.13.1.45.0 603
29 #.1.3.6.1.4.1.25597.13.1.46.0 8
30 #.1.3.6.1.4.1.25597.13.1.47.0 0
31 #.1.3.6.1.4.1.25597.13.1.48.0 96
32 #.1.3.6.1.4.1.25597.13.1.49.0 0
34 factory_settings['fireeye_mailq'] = {
35 'deferred': (1, 50),
36 'hold': (500, 1000),
37 'drop': (50, 500),
41 def parse_fireeye_mailq(info):
42 parsed = {}
43 for index, item in enumerate(['Deferred', 'Hold', 'Incoming', 'Active', 'Drop']):
44 parsed.update({item: info[0][index]})
45 return parsed
48 def check_fireeye_mailq(item, params, parsed):
49 for queue, value in parsed.iteritems():
50 infotext = 'Mails in %s queue: %s' % (queue.lower(), value)
51 warn, crit = params.get(queue.lower(), (None, None))
52 counter = 'mail_queue_%s_length' % queue.lower()
53 yield fireeye_check_generic(infotext, counter, int(value), warn, crit)
56 check_info['fireeye_mailq'] = {
57 'parse_function': parse_fireeye_mailq,
58 'inventory_function': lambda parsed: inventory_fireeye_generic(parsed, False, True),
59 'check_function': check_fireeye_mailq,
60 'service_description': 'Mail Queues',
61 'default_levels_variable': 'fireeye_mailq',
62 'group': 'fireeye_mailq',
63 'snmp_info': (
64 '.1.3.6.1.4.1.25597.13.1',
66 '44', # FE-FIREEYE-MIB::feDeferredEmailCount
67 '45', # FE-FIREEYE-MIB::feHoldQueueEmailCount
68 '47', # FE-FIREEYE-MIB::feIncomingEmailCount
69 '48', # FE-FIREEYE-MIB::feActiveEmailCount
70 '49', # FE-FIREEYE-MIB::feDropEmailCount
71 ]),
72 'snmp_scan_function': scan_fireeye,
73 'has_perfdata': True,
74 'includes': ['fireeye.include']