Module: check_mk
Branch: master
Commit: e1b1b0633816aa9ac27e52e3d14d56ff5c5ff601
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e1b1b0633816aa…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Sep 9 15:25:25 2014 +0200
bluecat_dhcp, bluecat_dns: Added missing Wato configuration
---
checks/bluecat_dhcp | 29 ++++++++------
checks/bluecat_dns | 25 +++++++-----
web/plugins/wato/check_parameters.py | 70 ++++++++++++++++++++++++++++++++++
3 files changed, 102 insertions(+), 22 deletions(-)
diff --git a/checks/bluecat_dhcp b/checks/bluecat_dhcp
index d303219..a78f5ea 100644
--- a/checks/bluecat_dhcp
+++ b/checks/bluecat_dhcp
@@ -24,9 +24,12 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# Example output from agent:
-# Put here the example output from your TCP-Based agent. If the
-# check is SNMP-Based, then remove this section
+factory_settings["bluecat_dhcp"] = {
+ "oper_states" : {
+ "warning" : [ 2, 3, 4 ],
+ "critical" : [ 5 ],
+ },
+}
def inventory_bluecat_dhcp(info):
return [(None, None)]
@@ -42,20 +45,22 @@ def check_bluecat_dhcp(item, _no_params, info):
}
state = 0
- if oper_state in [ 2, 3, 4 ]:
+ if oper_state in params['oper_states']['warning']:
state = 1
- elif oper_state == 5:
+ elif oper_state in params['oper_states']['critical']:
state = 2
yield state, "DHCP is %s" % oper_states[oper_state]
yield 0, '%s Leases per second' % leases_sec, [ ('leases', leases_sec
) ]
-check_info["bluecat_dhcp"] = {
- "check_function" : check_bluecat_dhcp,
- "inventory_function" : inventory_bluecat_dhcp,
- "service_description" : "DHCP",
- "has_perfdata" : True,
- "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.13315.2.1",
- "snmp_info" : (".1.3.6.1.4.1.13315.3.1.1.2.1", [
+check_info["bluecat_dhcp"] = {
+ "check_function" : check_bluecat_dhcp,
+ "inventory_function" : inventory_bluecat_dhcp,
+ "service_description" : "DHCP",
+ "has_perfdata" : True,
+ "default_levels_variable" : "bluecat_dhcp",
+ "group" : "bluecat_dhcp",
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.13315.2.1",
+ "snmp_info" : (".1.3.6.1.4.1.13315.3.1.1.2.1", [
1, # dhcpOperState
3, #
dhcpLeaseStatsSuccess
])
diff --git a/checks/bluecat_dns b/checks/bluecat_dns
index 47c5479..c6d4574 100644
--- a/checks/bluecat_dns
+++ b/checks/bluecat_dns
@@ -24,9 +24,12 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# Example output from agent:
-# Put here the example output from your TCP-Based agent. If the
-# check is SNMP-Based, then remove this section
+factory_settings["bluecat_dns"] = {
+ "oper_states" : {
+ "warning" : [ 2, 3, 4 ],
+ "critical" : [ 5 ],
+ },
+}
def inventory_bluecat_dns(info):
return [(None, None)]
@@ -42,18 +45,20 @@ def check_bluecat_dns(item, _no_params, info):
}
state = 0
- if oper_state in [ 2, 3, 4 ]:
+ if oper_state in params['oper_states']['warning']:
state = 1
- elif oper_state == 5:
+ elif oper_state in params['oper_states']['critical']:
state = 2
yield state, "DNS is %s" % oper_states[oper_state]
check_info["bluecat_dns"] = {
- "check_function" : check_bluecat_dns,
- "inventory_function" : inventory_bluecat_dns,
- "service_description" : "DNS",
- "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.13315.2.1",
- "snmp_info" : (".1.3.6.1.4.1.13315.3.1.2.2.1", [
+ "check_function" : check_bluecat_dns,
+ "inventory_function" : inventory_bluecat_dns,
+ "service_description" : "DNS",
+ "default_levels_variable" : "bluecat_dns",
+ "group" : "bluecat_dns",
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.13315.2.1",
+ "snmp_info" : (".1.3.6.1.4.1.13315.3.1.2.2.1", [
1, # DnsSerOperState
])
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 97b6d99..40c8175 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -6041,6 +6041,76 @@ register_check_parameters(
"first"
),
+register_check_parameters(
+ subgroup_networking,
+ "bluecat_dhcp",
+ _("Bluecat DHCP Settings"),
+ Dictionary(
+ elements = [
+ ( "oper_states",
+ Dictionary(
+ title = _("Oper States"),
+ elements = [
+ ( "warning",
+ ListChoice(
+ title = _("States treated as warning"),
+ choices = bluecat_operstates,
+ default_value = [ 2, 3, 4 ],
+ )
+ ),
+ ( "critical",
+ ListChoice(
+ title = _("States treated as critical"),
+ choices = bluecat_operstates,
+ default_value = [ 5 ],
+ )
+ ),
+ ],
+ required_keys = [ 'warning', 'critical' ],
+ )
+ ),
+ ],
+ required_keys = [ 'oper_states' ], # There is only one value, so its
required
+ ),
+ None,
+ "first"
+),
+
+register_check_parameters(
+ subgroup_networking,
+ "bluecat_dns",
+ _("Bluecat DNS Settings"),
+ Dictionary(
+ elements = [
+ ( "oper_states",
+ Dictionary(
+ title = _("Oper States"),
+ elements = [
+ ( "warning",
+ ListChoice(
+ title = _("States treated as warning"),
+ choices = bluecat_operstates,
+ default_value = [ 2, 3, 4 ],
+ )
+ ),
+ ( "critical",
+ ListChoice(
+ title = _("States treated as critical"),
+ choices = bluecat_operstates,
+ default_value = [ 5 ],
+ )
+ ),
+ ],
+ required_keys = [ 'warning', 'critical' ],
+ )
+ ),
+ ],
+ required_keys = [ 'oper_states' ], # There is only one value, so its
required
+ ),
+ None,
+ "first"
+),
+
bluecat_ha_operstates = [
( 1 , "standalone"),
( 2 , "active"),