Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / fortisandbox_queues
blob48ff16ce1e903f6adbef531df657c952ddd86fcd
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2018 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 # Nikolas Hagemann, comNET GmbH - nikolas.hagemann@comnetgmbh.com
29 #Example output:
30 #.1.3.6.1.4.1.12356.118.5.1.1.0 0
31 #.1.3.6.1.4.1.12356.118.5.1.2.0 0
32 #.1.3.6.1.4.1.12356.118.5.1.3.0 0
33 #.1.3.6.1.4.1.12356.118.5.1.4.0 0
34 #.1.3.6.1.4.1.12356.118.5.1.5.0 0
35 #.1.3.6.1.4.1.12356.118.5.1.6.0 0
36 #.1.3.6.1.4.1.12356.118.5.1.7.0 0
37 #.1.3.6.1.4.1.12356.118.5.1.8.0 0
38 #.1.3.6.1.4.1.12356.118.5.1.9.0 0
39 #.1.3.6.1.4.1.12356.118.5.1.10.0 0
40 #.1.3.6.1.4.1.12356.118.5.1.11.0 0
43 def parse_fortisandbox_queues(info):
44 queues = [
45 'Executable', 'PDF', 'Office', 'Flash', 'Web', 'Android', 'MAC', 'URL job', 'User defined',
46 'Non Sandboxing', 'Job Queue Assignment'
48 length = map(int, info[0])
49 parsed = dict(zip(queues, length))
50 return parsed
53 def inventory_fortisandbox_queues(parsed):
54 for queue in parsed.keys():
55 yield queue, {}
58 def check_fortisandbox_queues(item, params, parsed):
59 for queue, length in parsed.iteritems():
60 if queue == item:
61 warn, crit = params.get('length', (None, None))
62 state = 0
63 if crit and length >= crit:
64 state = 2
65 elif warn and length >= warn:
66 state = 1
67 perfdata = [('queue', length, warn, crit)]
68 infotext = 'Queue length: %s' % length
69 if state:
70 infotext += ' (warn/crit at %s/%s)' % (warn, crit)
71 return state, infotext, perfdata
74 check_info['fortisandbox_queues'] = {
75 'parse_function': parse_fortisandbox_queues,
76 'inventory_function': inventory_fortisandbox_queues,
77 'check_function': check_fortisandbox_queues,
78 'service_description': 'Pending %s files',
79 'has_perfdata': True,
80 'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.1.2.0') == '.1.3.6.1.4.1.12356.118.1.30006',
81 'snmp_info': (
82 '.1.3.6.1.4.1.12356.118.5.1',
84 '1', #fsaFTypeExe
85 '2', #fsaFTypePDF
86 '3', #fsaFTypeDOC
87 '4', #fsaFTypeFLASH
88 '5', #fsaFTypeWEB
89 '6', #fsaFTypeAndroid
90 '7', #fsaFTypeMAC
91 '8', #fsaFTypeURL
92 '9', #fsaFTypeExtra
93 '10', #fsaFTypeNOVM
94 '11', #fsaFTypePre
95 ]),
96 'group': 'fortisandbox_queues',