2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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.
28 def scan_infoblox(oid
):
29 return "infoblox" in oid(".1.3.6.1.2.1.1.1.0").lower() or \
30 oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7779.1")
33 # .--services------------------------------------------------------------.
35 # | ___ ___ _ ____ _(_) ___ ___ ___ |
36 # | / __|/ _ \ '__\ \ / / |/ __/ _ \/ __| |
37 # | \__ \ __/ | \ V /| | (_| __/\__ \ |
38 # | |___/\___|_| \_/ |_|\___\___||___/ |
40 # '----------------------------------------------------------------------'
43 def parse_infoblox_services(info
):
49 "5": "http-file-dist",
51 "7": "bloxtools-move",
80 "36": "power-supply1",
81 "37": "power-supply2",
92 "48": "network-capacity",
94 "50": "dns-cache-acceleration",
97 "53": "discovery-consolidator",
98 "54": "discovery-collector",
99 "55": "discovery-capacity",
100 "56": "threat-protection",
102 "58": "threat-analytics",
115 for _node
, service_id
, status_id
, description
in info
:
116 status
= map_status_id
.get(status_id
, "unexpected")
117 if status
in ["inactive", "unknown"]:
120 service_name
= map_service_ids
[service_id
]
121 service_nodes
= parsed
.setdefault(service_name
, [])
122 service_nodes
.append((status
, description
))
127 def inventory_infoblox_services(parsed
):
128 for service_name
in parsed
:
129 yield service_name
, None
132 def check_infoblox_services(item
, _no_params
, parsed
):
140 node_data
= parsed
[item
]
142 # For a clustered service the best state is used
143 min_status
, min_descr
= node_data
[0]
144 min_state
= map_status
[min_status
]
146 for status
, descr
in node_data
[1:]:
147 state
= map_status
[status
]
148 if state
< min_state
:
149 min_state
, min_status
, min_descr
= state
, status
, descr
151 infotext
= "Status: %s" % min_status
153 infotext
+= " (%s)" % min_descr
155 return min_state
, infotext
159 # .--statistics----------------------------------------------------------.
161 # | ___| |_ __ _| |_(_)___| |_(_) ___ ___ |
162 # | / __| __/ _` | __| / __| __| |/ __/ __| |
163 # | \__ \ || (_| | |_| \__ \ |_| | (__\__ \ |
164 # | |___/\__\__,_|\__|_|___/\__|_|\___|___/ |
166 # '----------------------------------------------------------------------'
169 def inventory_infoblox_statistics(info
):
170 return [(None, None)]
173 def check_infoblox_statistics(ty
, stats
):
176 for what
, what_val
, what_textfield
, what_info
in stats
:
177 texts
.setdefault(what_textfield
, [])
178 texts
[what_textfield
].append("%d %s" % (what_val
, what_info
))
179 perfdata
.append(("%s_%s" % (ty
, what
), what_val
))
182 for what
, entries
in texts
.items():
183 infotexts
.append("%s: %s" % (what
, ", ".join(entries
)))
185 return 0, " - ".join(infotexts
), perfdata