GUI CSS: Deployed view styles for layouts (CMK-1171)
[check_mk.git] / checks / sophos_messages
blobdc98336f5fcaa7af43a3b179393402ecd665deb8
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.2604.1.1.1.4.1.2.1 Legit --> SOPHOS::counterType.1
28 # .1.3.6.1.4.1.2604.1.1.1.4.1.2.2 Blocked --> SOPHOS::counterType.2
29 # .1.3.6.1.4.1.2604.1.1.1.4.1.2.9 InvalidRecipient --> SOPHOS::counterType.9
31 # .1.3.6.1.4.1.2604.1.1.1.4.1.3.1 92 --> SOPHOS::counterInbound.1
32 # .1.3.6.1.4.1.2604.1.1.1.4.1.3.2 10 --> SOPHOS::counterInbound.2
33 # .1.3.6.1.4.1.2604.1.1.1.4.1.3.9 2 --> SOPHOS::counterInbound.9
35 # .1.3.6.1.4.1.2604.1.1.1.4.1.4.1 8 --> SOPHOS::counterOutbound.1
36 # .1.3.6.1.4.1.2604.1.1.1.4.1.4.2 0 --> SOPHOS::counterOutbound.2
37 # .1.3.6.1.4.1.2604.1.1.1.4.1.4.9 0 --> SOPHOS::counterOutbound.9
39 # TODO levels?
42 def inventory_sophos_messages(info):
43 return [(line[0].replace("InvalidRecipient", "Invalid Recipient"), None) for line in info]
46 def check_sophos_messages(item, params, info):
47 for counter_type, inbound_str, outbound_str in info:
48 if counter_type.replace("InvalidRecipient", "Invalid Recipient") == item:
49 now = time.time()
50 inbound = get_rate("inbound", now, int(inbound_str))
51 outbound = get_rate("outbound", now, int(outbound_str))
52 infotext = "%.1f Inbounds and Outbounds/s, %.1f Inbounds/s, %.1f Outbounds/s" % \
53 (inbound + outbound, inbound, outbound)
54 return 0, infotext, [("messages_inbound", inbound), ("messages_outbound", outbound)]
57 check_info['sophos_messages'] = {
58 'inventory_function': inventory_sophos_messages,
59 'check_function': check_sophos_messages,
60 'service_description': 'Messages %s',
61 'has_perfdata': True,
62 'snmp_info': (
63 ".1.3.6.1.4.1.2604.1.1.1.4.1",
65 "2", # counterType -> read-only
66 "3", # counterInbound
67 "4", # counterOutbound
68 ]),
69 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.2604",