Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / infoblox_replication_status
blobdcc2bad4b824c549b2c2ad958fb891dd3a76f7ae
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 # 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.7779.3.1.1.2.1.2.1.1.X.X.X.X.X X.X.X.X --> IB-PLATFORMONE-MIB::ibNodeIPAddress."11.112.133.14"
28 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.1.X.X.X.X.X X.X.X.X --> IB-PLATFORMONE-MIB::ibNodeIPAddress."11.112.133.17"
29 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.2.X.X.X.X.X Online --> IB-PLATFORMONE-MIB::ibNodeReplicationStatus."11.112.133.14"
30 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.2.X.X.X.X.X Online --> IB-PLATFORMONE-MIB::ibNodeReplicationStatus."11.112.133.17"
31 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.3.X.X.X.X.X 0 --> IB-PLATFORMONE-MIB::ibNodeQueueFromMaster."11.112.133.14"
32 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.3.X.X.X.X.X 0 --> IB-PLATFORMONE-MIB::ibNodeQueueFromMaster."11.112.133.17"
33 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.4.X.X.X.X.X 2016/04/13 14:15:51 --> IB-PLATFORMONE-MIB::ibNodeLastRepTimeFromMaster."11.112.133.14"
34 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.4.X.X.X.X.X 2016/04/13 14:15:51 --> IB-PLATFORMONE-MIB::ibNodeLastRepTimeFromMaster."11.112.133.17"
35 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.5.X.X.X.X.X 0 --> IB-PLATFORMONE-MIB::ibNodeQueueToMaster."11.112.133.14"
36 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.5.X.X.X.X.X 0 --> IB-PLATFORMONE-MIB::ibNodeQueueToMaster."11.112.133.17"
37 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.6.X.X.X.X.X 2016/04/13 14:12:59 --> IB-PLATFORMONE-MIB::ibNodeLastRepTimeToMaster."11.112.133.14"
38 # .1.3.6.1.4.1.7779.3.1.1.2.1.2.1.6.X.X.X.X.X 2016/04/13 14:15:51 --> IB-PLATFORMONE-MIB::ibNodeLastRepTimeToMaster."11.112.133.17"
41 def inventory_infoblox_replication_status(info):
42 return [(line[0], None) for line in info]
45 def check_infoblox_replication_status(item, _no_params, info):
46 for ip_addr, status, queue_from_master, time_from_master, \
47 queue_to_master, time_to_master in info:
48 if ip_addr == item:
49 status_readable = status.lower()
50 if status_readable == "online":
51 state = 0
52 else:
53 state = 2
55 return state, "Status: %s, Queue from master: %s (%s), Queue to master: %s (%s)" % \
56 (status_readable, queue_from_master, time_from_master,
57 queue_to_master, time_to_master)
60 check_info['infoblox_replication_status'] = {
61 'inventory_function': inventory_infoblox_replication_status,
62 'check_function': check_infoblox_replication_status,
63 'service_description': 'Replication %s',
64 'snmp_info': (
65 ".1.3.6.1.4.1.7779.3.1.1.2.1.2.1",
67 "1", # IB-PLATFORMONE-MIB::ibNodeIPAddress
68 "2", # IB-PLATFORMONE-MIB::ibNodeReplicationStatus
69 "3", # IB-PLATFORMONE-MIB::ibNodeQueueFromMaster
70 "4", # IB-PLATFORMONE-MIB::ibNodeLastRepTimeFromMaster
71 "5", # IB-PLATFORMONE-MIB::ibNodeQueueToMaster
72 "6", # IB-PLATFORMONE-MIB::ibNodeLastRepTimeToMaster
73 ]),
74 'snmp_scan_function': scan_infoblox,
75 'includes': ["infoblox.include"],