Cleanup config.nodes_of
[check_mk.git] / checks / kemp_loadmaster_realserver
blob88276bb2d6736c437dfb95c0df5b5124e9819c88
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 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 # example for contents of info:
28 # IP address id state
29 # ['10.20.30.101', '1', '1'],
30 # ['10.20.30.102', '2', '1'],
31 # ['10.20.30.101', '3', '1'],
32 # ['10.20.30.102', '4', '1'],
33 # ['10.20.30.101', '5', '1'],
34 # ['10.20.30.102', '6', '1']
37 def inventory_kemp_loadmaster_realserver(info):
38 for line in info:
39 if line[2] not in ['4', '']: # Skip disabled servers
40 yield line[0], None
43 def check_kemp_loadmaster_realserver(item, _no_params, info):
44 states = {
45 '1': (0, 'in service'),
46 '2': (2, 'out of service'),
47 '3': (2, 'failed'),
48 '4': (2, 'disabled'),
51 for ipaddress, _server_id, state_id in info:
52 if item == ipaddress:
53 state, state_name = states[state_id]
54 return state, "State: %s" % state_name
57 check_info["kemp_loadmaster_realserver"] = {
58 "inventory_function": inventory_kemp_loadmaster_realserver,
59 "check_function": check_kemp_loadmaster_realserver,
60 "service_description": "Real Server %s",
61 "snmp_info": (
62 ".1.3.6.1.4.1.12196.13.2.1",
64 2, # IP address: B100-MIB::rSip
65 5, # ID: B100-MIB::rSidx
66 8, # state: B100-MIB::rSstate
67 ]),
68 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0") in
69 [".1.3.6.1.4.1.12196.250.10", ".1.3.6.1.4.1.2021.250.10"],